Bitcoin Core  0.20.99
P2P Digital Currency
Classes | Macros | Functions
util.h File Reference
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <limits.h>
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  secp256k1_callback
 

Macros

#define TEST_FAILURE(msg)
 
#define EXPECT(x, c)   (x)
 
#define CHECK(cond)
 
#define VERIFY_CHECK(cond)   do { (void)(cond); } while(0)
 
#define VERIFY_SETUP(stmt)
 
#define VG_UNDEF(x, y)
 
#define VG_CHECK(x, y)
 
#define VG_CHECK_VERIFY(x, y)
 
#define ALIGNMENT   16
 
#define ROUND_TO_ALIGN(size)   (((size + ALIGNMENT - 1) / ALIGNMENT) * ALIGNMENT)
 
#define SECP256K1_RESTRICT
 
#define I64FORMAT   "lld"
 
#define I64uFORMAT   "llu"
 

Functions

static SECP256K1_INLINE void secp256k1_callback_call (const secp256k1_callback *const cb, const char *const text)
 
static SECP256K1_INLINE void * checked_malloc (const secp256k1_callback *cb, size_t size)
 
static SECP256K1_INLINE void * checked_realloc (const secp256k1_callback *cb, void *ptr, size_t size)
 
static SECP256K1_INLINE void * manual_alloc (void **prealloc_ptr, size_t alloc_size, void *base, size_t max_size)
 
static SECP256K1_INLINE void memczero (void *s, size_t len, int flag)
 
static SECP256K1_INLINE void secp256k1_int_cmov (int *r, const int *a, int flag)
 If flag is true, set *r equal to *a; otherwise leave it. More...
 

Macro Definition Documentation

◆ ALIGNMENT

#define ALIGNMENT   16

Definition at line 113 of file util.h.

◆ CHECK

#define CHECK (   cond)
Value:
do { \
if (EXPECT(!(cond), 0)) { \
TEST_FAILURE("test condition failed: " #cond); \
} \
} while(0)
#define EXPECT(x, c)
Definition: util.h:43

Definition at line 53 of file util.h.

◆ EXPECT

#define EXPECT (   x,
 
)    (x)

Definition at line 43 of file util.h.

◆ I64FORMAT

#define I64FORMAT   "lld"

Definition at line 169 of file util.h.

◆ I64uFORMAT

#define I64uFORMAT   "llu"

Definition at line 170 of file util.h.

◆ ROUND_TO_ALIGN

#define ROUND_TO_ALIGN (   size)    (((size + ALIGNMENT - 1) / ALIGNMENT) * ALIGNMENT)

Definition at line 116 of file util.h.

◆ SECP256K1_RESTRICT

#define SECP256K1_RESTRICT

Definition at line 158 of file util.h.

◆ TEST_FAILURE

#define TEST_FAILURE (   msg)
Value:
do { \
fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, msg); \
abort(); \
} while(0)

Definition at line 34 of file util.h.

◆ VERIFY_CHECK

#define VERIFY_CHECK (   cond)    do { (void)(cond); } while(0)

Definition at line 68 of file util.h.

◆ VERIFY_SETUP

#define VERIFY_SETUP (   stmt)

Definition at line 69 of file util.h.

◆ VG_CHECK

#define VG_CHECK (   x,
 
)

Definition at line 80 of file util.h.

◆ VG_CHECK_VERIFY

#define VG_CHECK_VERIFY (   x,
 
)

Definition at line 88 of file util.h.

◆ VG_UNDEF

#define VG_UNDEF (   x,
 
)

Definition at line 79 of file util.h.

Function Documentation

◆ checked_malloc()

static SECP256K1_INLINE void* checked_malloc ( const secp256k1_callback cb,
size_t  size 
)
static

Definition at line 91 of file util.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checked_realloc()

static SECP256K1_INLINE void* checked_realloc ( const secp256k1_callback cb,
void *  ptr,
size_t  size 
)
static

Definition at line 99 of file util.h.

Here is the call graph for this function:

◆ manual_alloc()

static SECP256K1_INLINE void* manual_alloc ( void **  prealloc_ptr,
size_t  alloc_size,
void *  base,
size_t  max_size 
)
static

Definition at line 134 of file util.h.

Here is the caller graph for this function:

◆ memczero()

static SECP256K1_INLINE void memczero ( void *  s,
size_t  len,
int  flag 
)
static

Definition at line 183 of file util.h.

Here is the caller graph for this function:

◆ secp256k1_callback_call()

static SECP256K1_INLINE void secp256k1_callback_call ( const secp256k1_callback *const  cb,
const char *const  text 
)
static

Definition at line 24 of file util.h.

Here is the caller graph for this function:

◆ secp256k1_int_cmov()

static SECP256K1_INLINE void secp256k1_int_cmov ( int *  r,
const int *  a,
int  flag 
)
static

If flag is true, set *r equal to *a; otherwise leave it.

Constant-time. Both *r and *a must be initialized and non-negative.

Definition at line 198 of file util.h.

Here is the caller graph for this function: