Skip to content

Commit 3680974

Browse files
kbowers-jumpReisen
authored andcommitted
Use STYLE macro semantics like other includes
1 parent 5b6543a commit 3680974

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
#ifndef _pyth_oracle_util_compat_stdint_h_
22
#define _pyth_oracle_util_compat_stdint_h_
33

4-
/* solana uses its own definitions for stdint types and that can cause
5-
problems with compilation */
4+
/* Include functionality from <stdint.h>. Define
5+
PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE to indicate how to do this:
6+
0 - Use stdint.h directly
7+
1 - Use solana_sdk.h (solana uses its own definitions for stdint
8+
types and that can conflicts with stdint.h)
9+
Defaults to 0 or 1 depending on if __bpf__ is set. */
610

7-
#ifdef __bpf__
11+
#ifndef PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE
12+
#ifndef __bpf__
13+
#define PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE 0
14+
#else
15+
#define PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE 1
16+
#endif
17+
#endif
18+
19+
#if PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE==0
20+
#include <stdint.h>
21+
#elif PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE==1
822
#include <solana_sdk.h>
923
typedef uint64_t uintptr_t;
1024
#else
11-
#include <stdint.h>
25+
#error "Unsupported PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE"
1226
#endif
1327

1428
#endif /* _pyth_oracle_util_compat_stdint_h_ */

0 commit comments

Comments
 (0)