Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
scalar_8x32_impl.h File Reference
#include "modinv32_impl.h"
Include dependency graph for scalar_8x32_impl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SECP256K1_N_0   ((uint32_t)0xD0364141UL)
 
#define SECP256K1_N_1   ((uint32_t)0xBFD25E8CUL)
 
#define SECP256K1_N_2   ((uint32_t)0xAF48A03BUL)
 
#define SECP256K1_N_3   ((uint32_t)0xBAAEDCE6UL)
 
#define SECP256K1_N_4   ((uint32_t)0xFFFFFFFEUL)
 
#define SECP256K1_N_5   ((uint32_t)0xFFFFFFFFUL)
 
#define SECP256K1_N_6   ((uint32_t)0xFFFFFFFFUL)
 
#define SECP256K1_N_7   ((uint32_t)0xFFFFFFFFUL)
 
#define SECP256K1_N_C_0   (~SECP256K1_N_0 + 1)
 
#define SECP256K1_N_C_1   (~SECP256K1_N_1)
 
#define SECP256K1_N_C_2   (~SECP256K1_N_2)
 
#define SECP256K1_N_C_3   (~SECP256K1_N_3)
 
#define SECP256K1_N_C_4   (1)
 
#define SECP256K1_N_H_0   ((uint32_t)0x681B20A0UL)
 
#define SECP256K1_N_H_1   ((uint32_t)0xDFE92F46UL)
 
#define SECP256K1_N_H_2   ((uint32_t)0x57A4501DUL)
 
#define SECP256K1_N_H_3   ((uint32_t)0x5D576E73UL)
 
#define SECP256K1_N_H_4   ((uint32_t)0xFFFFFFFFUL)
 
#define SECP256K1_N_H_5   ((uint32_t)0xFFFFFFFFUL)
 
#define SECP256K1_N_H_6   ((uint32_t)0xFFFFFFFFUL)
 
#define SECP256K1_N_H_7   ((uint32_t)0x7FFFFFFFUL)
 
#define muladd(a, b)
 
#define muladd_fast(a, b)
 
#define sumadd(a)
 
#define sumadd_fast(a)
 
#define extract(n)
 
#define extract_fast(n)
 

Macro Definition Documentation

◆ extract

#define extract ( n)
Value:
{ \
(n) = c0; \
c0 = c1; \
c1 = c2; \
c2 = 0; \
}

Extract the lowest 32 bits of (c0,c1,c2) into n, and left shift the number 32 bits.

Definition at line 314 of file scalar_8x32_impl.h.

314#define extract(n) { \
315 (n) = c0; \
316 c0 = c1; \
317 c1 = c2; \
318 c2 = 0; \
319}

◆ extract_fast

#define extract_fast ( n)
Value:
{ \
(n) = c0; \
c0 = c1; \
c1 = 0; \
VERIFY_CHECK(c2 == 0); \
}

Extract the lowest 32 bits of (c0,c1,c2) into n, and left shift the number 32 bits. c2 is required to be zero.

Definition at line 322 of file scalar_8x32_impl.h.

322#define extract_fast(n) { \
323 (n) = c0; \
324 c0 = c1; \
325 c1 = 0; \
326 VERIFY_CHECK(c2 == 0); \
327}

◆ muladd

#define muladd ( a,
b )
Value:
{ \
uint32_t tl, th; \
{ \
uint64_t t = (uint64_t)a * b; \
th = t >> 32; /* at most 0xFFFFFFFE */ \
tl = t; \
} \
c0 += tl; /* overflow is handled on the next line */ \
th += (c0 < tl); /* at most 0xFFFFFFFF */ \
c1 += th; /* overflow is handled on the next line */ \
c2 += (c1 < th); /* never overflows by contract (verified in the next line) */ \
VERIFY_CHECK((c1 >= th) || (c2 != 0)); \
}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
unsigned int uint32_t
Definition stdint.h:126
unsigned __int64 uint64_t
Definition stdint.h:136

Add a*b to the number defined by (c0,c1,c2). c2 must never overflow.

Definition at line 268 of file scalar_8x32_impl.h.

268#define muladd(a,b) { \
269 uint32_t tl, th; \
270 { \
271 uint64_t t = (uint64_t)a * b; \
272 th = t >> 32; /* at most 0xFFFFFFFE */ \
273 tl = t; \
274 } \
275 c0 += tl; /* overflow is handled on the next line */ \
276 th += (c0 < tl); /* at most 0xFFFFFFFF */ \
277 c1 += th; /* overflow is handled on the next line */ \
278 c2 += (c1 < th); /* never overflows by contract (verified in the next line) */ \
279 VERIFY_CHECK((c1 >= th) || (c2 != 0)); \
280}

◆ muladd_fast

#define muladd_fast ( a,
b )
Value:
{ \
uint32_t tl, th; \
{ \
uint64_t t = (uint64_t)a * b; \
th = t >> 32; /* at most 0xFFFFFFFE */ \
tl = t; \
} \
c0 += tl; /* overflow is handled on the next line */ \
th += (c0 < tl); /* at most 0xFFFFFFFF */ \
c1 += th; /* never overflows by contract (verified in the next line) */ \
VERIFY_CHECK(c1 >= th); \
}

Add a*b to the number defined by (c0,c1). c1 must never overflow.

Definition at line 283 of file scalar_8x32_impl.h.

283#define muladd_fast(a,b) { \
284 uint32_t tl, th; \
285 { \
286 uint64_t t = (uint64_t)a * b; \
287 th = t >> 32; /* at most 0xFFFFFFFE */ \
288 tl = t; \
289 } \
290 c0 += tl; /* overflow is handled on the next line */ \
291 th += (c0 < tl); /* at most 0xFFFFFFFF */ \
292 c1 += th; /* never overflows by contract (verified in the next line) */ \
293 VERIFY_CHECK(c1 >= th); \
294}

◆ SECP256K1_N_0

#define SECP256K1_N_0   ((uint32_t)0xD0364141UL)

Definition at line 13 of file scalar_8x32_impl.h.

◆ SECP256K1_N_1

#define SECP256K1_N_1   ((uint32_t)0xBFD25E8CUL)

Definition at line 14 of file scalar_8x32_impl.h.

◆ SECP256K1_N_2

#define SECP256K1_N_2   ((uint32_t)0xAF48A03BUL)

Definition at line 15 of file scalar_8x32_impl.h.

◆ SECP256K1_N_3

#define SECP256K1_N_3   ((uint32_t)0xBAAEDCE6UL)

Definition at line 16 of file scalar_8x32_impl.h.

◆ SECP256K1_N_4

#define SECP256K1_N_4   ((uint32_t)0xFFFFFFFEUL)

Definition at line 17 of file scalar_8x32_impl.h.

◆ SECP256K1_N_5

#define SECP256K1_N_5   ((uint32_t)0xFFFFFFFFUL)

Definition at line 18 of file scalar_8x32_impl.h.

◆ SECP256K1_N_6

#define SECP256K1_N_6   ((uint32_t)0xFFFFFFFFUL)

Definition at line 19 of file scalar_8x32_impl.h.

◆ SECP256K1_N_7

#define SECP256K1_N_7   ((uint32_t)0xFFFFFFFFUL)

Definition at line 20 of file scalar_8x32_impl.h.

◆ SECP256K1_N_C_0

#define SECP256K1_N_C_0   (~SECP256K1_N_0 + 1)

Definition at line 23 of file scalar_8x32_impl.h.

◆ SECP256K1_N_C_1

#define SECP256K1_N_C_1   (~SECP256K1_N_1)

Definition at line 24 of file scalar_8x32_impl.h.

◆ SECP256K1_N_C_2

#define SECP256K1_N_C_2   (~SECP256K1_N_2)

Definition at line 25 of file scalar_8x32_impl.h.

◆ SECP256K1_N_C_3

#define SECP256K1_N_C_3   (~SECP256K1_N_3)

Definition at line 26 of file scalar_8x32_impl.h.

◆ SECP256K1_N_C_4

#define SECP256K1_N_C_4   (1)

Definition at line 27 of file scalar_8x32_impl.h.

◆ SECP256K1_N_H_0

#define SECP256K1_N_H_0   ((uint32_t)0x681B20A0UL)

Definition at line 30 of file scalar_8x32_impl.h.

◆ SECP256K1_N_H_1

#define SECP256K1_N_H_1   ((uint32_t)0xDFE92F46UL)

Definition at line 31 of file scalar_8x32_impl.h.

◆ SECP256K1_N_H_2

#define SECP256K1_N_H_2   ((uint32_t)0x57A4501DUL)

Definition at line 32 of file scalar_8x32_impl.h.

◆ SECP256K1_N_H_3

#define SECP256K1_N_H_3   ((uint32_t)0x5D576E73UL)

Definition at line 33 of file scalar_8x32_impl.h.

◆ SECP256K1_N_H_4

#define SECP256K1_N_H_4   ((uint32_t)0xFFFFFFFFUL)

Definition at line 34 of file scalar_8x32_impl.h.

◆ SECP256K1_N_H_5

#define SECP256K1_N_H_5   ((uint32_t)0xFFFFFFFFUL)

Definition at line 35 of file scalar_8x32_impl.h.

◆ SECP256K1_N_H_6

#define SECP256K1_N_H_6   ((uint32_t)0xFFFFFFFFUL)

Definition at line 36 of file scalar_8x32_impl.h.

◆ SECP256K1_N_H_7

#define SECP256K1_N_H_7   ((uint32_t)0x7FFFFFFFUL)

Definition at line 37 of file scalar_8x32_impl.h.

◆ sumadd

#define sumadd ( a)
Value:
{ \
unsigned int over; \
c0 += (a); /* overflow is handled on the next line */ \
over = (c0 < (a)); \
c1 += over; /* overflow is handled on the next line */ \
c2 += (c1 < over); /* never overflows by contract */ \
}

Add a to the number defined by (c0,c1,c2). c2 must never overflow.

Definition at line 297 of file scalar_8x32_impl.h.

297#define sumadd(a) { \
298 unsigned int over; \
299 c0 += (a); /* overflow is handled on the next line */ \
300 over = (c0 < (a)); \
301 c1 += over; /* overflow is handled on the next line */ \
302 c2 += (c1 < over); /* never overflows by contract */ \
303}

◆ sumadd_fast

#define sumadd_fast ( a)
Value:
{ \
c0 += (a); /* overflow is handled on the next line */ \
c1 += (c0 < (a)); /* never overflows by contract (verified the next line) */ \
VERIFY_CHECK((c1 != 0) | (c0 >= (a))); \
VERIFY_CHECK(c2 == 0); \
}

Add a to the number defined by (c0,c1). c1 must never overflow, c2 must be zero.

Definition at line 306 of file scalar_8x32_impl.h.

306#define sumadd_fast(a) { \
307 c0 += (a); /* overflow is handled on the next line */ \
308 c1 += (c0 < (a)); /* never overflows by contract (verified the next line) */ \
309 VERIFY_CHECK((c1 != 0) | (c0 >= (a))); \
310 VERIFY_CHECK(c2 == 0); \
311}