1 /**********************************************************************
2 * Copyright (c) 2013, 2014 Pieter Wuille *
3 * Distributed under the MIT software license, see the accompanying *
4 * file COPYING or http://www.opensource.org/licenses/mit-license.php.*
5 **********************************************************************/
7 #ifndef _SECP256K1_FIELD_REPR_
8 #define _SECP256K1_FIELD_REPR_
13 /* X = sum(i=0..4, elem[i]*2^52) mod n */
21 /* Unpacks a constant into a overlapping multi-limbed FE element. */
22 #define SECP256K1_FE_CONST_INNER(d7, d6, d5, d4, d3, d2, d1, d0) { \
23 (d0) | ((uint64_t)(d1) & 0xFFFFFUL) << 32, \
24 ((uint64_t)(d1) >> 20) | ((uint64_t)(d2)) << 12 | ((uint64_t)(d3) & 0xFFUL) << 44, \
25 ((uint64_t)(d3) >> 8) | ((uint64_t)(d4) & 0xFFFFFFFUL) << 24, \
26 ((uint64_t)(d4) >> 28) | ((uint64_t)(d5)) << 4 | ((uint64_t)(d6) & 0xFFFFUL) << 36, \
27 ((uint64_t)(d6) >> 16) | ((uint64_t)(d7)) << 16 \
31 #define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)), 1, 1}
33 #define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0))}
38 } secp256k1_fe_storage_t;
40 #define SECP256K1_FE_STORAGE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{ \
41 (d0) | ((uint64_t)(d1)) << 32, \
42 (d2) | ((uint64_t)(d3)) << 32, \
43 (d4) | ((uint64_t)(d5)) << 32, \
44 (d6) | ((uint64_t)(d7)) << 32 \