Ruby  3.1.0dev(2021-09-10revisionb76ad15ed0da636161de0243c547ee1e6fc95681)
Macros
bits.h File Reference

(b76ad15ed0da636161de0243c547ee1e6fc95681)

#include "feature.h"
#include "static_assert.h"
Include dependency graph for bits.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define numberof(array)   ((int)(sizeof(array) / sizeof((array)[0])))
 
#define roomof(x, y)   (((x) + (y) - 1) / (y))
 
#define type_roomof(x, y)   roomof(sizeof(x), sizeof(y))
 
#define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max)
 
#define bit_length(x)
 

Macro Definition Documentation

◆ bit_length

#define bit_length (   x)
Value:
(unsigned int) \
(sizeof(x) <= sizeof(int32_t) ? 32 - nlz_int32((uint32_t)(x)) : \
64 - nlz_int64((uint64_t)(x)))

Definition at line 36 of file bits.h.

◆ MUL_OVERFLOW_SIGNED_INTEGER_P

#define MUL_OVERFLOW_SIGNED_INTEGER_P (   a,
  b,
  min,
  max 
)
Value:
( \
(a) == 0 ? 0 : \
(a) == -1 ? (b) < -(max) : \
(a) > 0 ? \
((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \
((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b)))

Definition at line 22 of file bits.h.

◆ numberof

#define numberof (   array)    ((int)(sizeof(array) / sizeof((array)[0])))

Definition at line 18 of file bits.h.

◆ roomof

#define roomof (   x,
  y 
)    (((x) + (y) - 1) / (y))

Definition at line 19 of file bits.h.

◆ type_roomof

#define type_roomof (   x,
  y 
)    roomof(sizeof(x), sizeof(y))

Definition at line 20 of file bits.h.

uint64_t
unsigned long long uint64_t
Definition: sha2.h:102
uint32_t
unsigned int uint32_t
Definition: sha2.h:101