Skip to content

Commit 8e142ca

Browse files
committed
Move SECP256K1_INLINE macro definition out from include/secp256k1.h
1 parent 7744589 commit 8e142ca

14 files changed

+28
-12
lines changed

include/secp256k1.h

-12
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,6 @@ typedef int (*secp256k1_nonce_function)(
122122
# endif
123123
# endif
124124

125-
# if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
126-
# if SECP256K1_GNUC_PREREQ(2,7)
127-
# define SECP256K1_INLINE __inline__
128-
# elif (defined(_MSC_VER))
129-
# define SECP256K1_INLINE __inline
130-
# else
131-
# define SECP256K1_INLINE
132-
# endif
133-
# else
134-
# define SECP256K1_INLINE inline
135-
# endif
136-
137125
/* When this header is used at build-time the SECP256K1_BUILD define needs to be set
138126
* to correctly setup export attributes and nullness checks. This is normally done
139127
* by secp256k1.c but to guard against this header being included before secp256k1.c

src/field_5x52_asm_impl.h

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#ifndef SECP256K1_FIELD_INNER5X52_IMPL_H
1515
#define SECP256K1_FIELD_INNER5X52_IMPL_H
1616

17+
#include "util.h"
18+
1719
SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint64_t *r, const uint64_t *a, const uint64_t * SECP256K1_RESTRICT b) {
1820
/**
1921
* Registers: rdx:rax = multiplication accumulator

src/field_5x52_int128_impl.h

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <stdint.h>
1111

1212
#include "int128.h"
13+
#include "util.h"
1314

1415
#ifdef VERIFY
1516
#define VERIFY_BITS(x, n) VERIFY_CHECK(((x) >> (n)) == 0)

src/group_impl.h

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "field.h"
1111
#include "group.h"
12+
#include "util.h"
1213

1314
/* Begin of section generated by sage/gen_exhaustive_groups.sage. */
1415
#define SECP256K1_G_ORDER_7 SECP256K1_GE_CONST(\

src/int128_native_impl.h

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define SECP256K1_INT128_NATIVE_IMPL_H
33

44
#include "int128.h"
5+
#include "util.h"
56

67
static SECP256K1_INLINE void secp256k1_u128_load(secp256k1_uint128 *r, uint64_t hi, uint64_t lo) {
78
*r = (((uint128_t)hi) << 64) + lo;

src/int128_struct_impl.h

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define SECP256K1_INT128_STRUCT_IMPL_H
33

44
#include "int128.h"
5+
#include "util.h"
56

67
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64)) /* MSVC */
78
# include <intrin.h>

src/modules/extrakeys/main_impl.h

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "../../../include/secp256k1.h"
1111
#include "../../../include/secp256k1_extrakeys.h"
12+
#include "../../util.h"
1213

1314
static SECP256K1_INLINE int secp256k1_xonly_pubkey_load(const secp256k1_context* ctx, secp256k1_ge *ge, const secp256k1_xonly_pubkey *pubkey) {
1415
return secp256k1_pubkey_load(ctx, ge, (const secp256k1_pubkey *) pubkey);

src/scalar_4x64_impl.h

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "checkmem.h"
1111
#include "int128.h"
1212
#include "modinv64_impl.h"
13+
#include "util.h"
1314

1415
/* Limbs of the secp256k1 order. */
1516
#define SECP256K1_N_0 ((uint64_t)0xBFD25E8CD0364141ULL)

src/scalar_8x32_impl.h

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "checkmem.h"
1111
#include "modinv32_impl.h"
12+
#include "util.h"
1213

1314
/* Limbs of the secp256k1 order. */
1415
#define SECP256K1_N_0 ((uint32_t)0xD0364141UL)

src/scalar_low_impl.h

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "checkmem.h"
1111
#include "scalar.h"
12+
#include "util.h"
1213

1314
#include <string.h>
1415

src/testrand.h

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#ifndef SECP256K1_TESTRAND_H
88
#define SECP256K1_TESTRAND_H
99

10+
#include "util.h"
11+
1012
/* A non-cryptographic RNG used only for test infrastructure. */
1113

1214
/** Seed the pseudorandom number generator for testing. */

src/testrand_impl.h

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "testrand.h"
1515
#include "hash.h"
16+
#include "util.h"
1617

1718
static uint64_t secp256k1_test_state[4];
1819
static uint64_t secp256k1_test_rng_integer;

src/tests_exhaustive.c

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "testrand_impl.h"
2121
#include "ecmult_compute_table_impl.h"
2222
#include "ecmult_gen_compute_table_impl.h"
23+
#include "util.h"
2324

2425
static int count = 2;
2526

src/util.h

+14
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#ifndef SECP256K1_UTIL_H
88
#define SECP256K1_UTIL_H
99

10+
#include "../include/secp256k1.h"
11+
1012
#include <stdlib.h>
1113
#include <stdint.h>
1214
#include <stdio.h>
@@ -17,6 +19,18 @@
1719
#define DEBUG_CONFIG_MSG(x) "DEBUG_CONFIG: " x
1820
#define DEBUG_CONFIG_DEF(x) DEBUG_CONFIG_MSG(#x "=" STR(x))
1921

22+
# if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
23+
# if SECP256K1_GNUC_PREREQ(2,7)
24+
# define SECP256K1_INLINE __inline__
25+
# elif (defined(_MSC_VER))
26+
# define SECP256K1_INLINE __inline
27+
# else
28+
# define SECP256K1_INLINE
29+
# endif
30+
# else
31+
# define SECP256K1_INLINE inline
32+
# endif
33+
2034
typedef struct {
2135
void (*fn)(const char *text, void* data);
2236
const void* data;

0 commit comments

Comments
 (0)