GNU libmicrohttpd 1.0.1
Loading...
Searching...
No Matches
mhd_bithelpers.h File Reference

macros for bits manipulations More...

#include "mhd_options.h"
#include <stdint.h>
#include "mhd_byteorder.h"
Include dependency graph for mhd_bithelpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __has_builtin(x)   0
 
#define _MHD_has_builtin_dummy   1
 
#define _MHD_BYTES_SWAP32(value32)
 
#define _MHD_BYTES_SWAP64(value64)
 
#define _MHD_PUT_64BIT_LE_SLOW(addr, value64)
 
#define _MHD_PUT_64BIT_LE(addr, value64)
 
#define _MHD_PUT_64BIT_LE_UNALIGNED   1
 
#define _MHD_PUT_32BIT_LE(addr, value32)
 
#define _MHD_PUT_32BIT_LE_UNALIGNED   1
 
#define _MHD_GET_32BIT_LE(addr)
 
#define _MHD_GET_32BIT_LE_UNALIGNED   1
 
#define _MHD_PUT_64BIT_BE_SLOW(addr, value64)
 
#define _MHD_PUT_64BIT_BE(addr, value64)   _MHD_PUT_64BIT_BE_SLOW(addr, value64)
 
#define _MHD_PUT_64BIT_BE_UNALIGNED   1
 
#define _MHD_GET_64BIT_BE(addr)
 
#define _MHD_GET_64BIT_BE_ALLOW_UNALIGNED   1
 
#define _MHD_PUT_32BIT_BE(addr, value32)
 
#define _MHD_PUT_32BIT_BE_UNALIGNED   1
 
#define _MHD_GET_32BIT_BE(addr)
 
#define _MHD_GET_32BIT_BE_UNALIGNED   1
 

Functions

_MHD_static_inline void _MHD_PUT_64BIT_LE_SAFE (void *dst, uint64_t value)
 
_MHD_static_inline void _MHD_PUT_64BIT_BE_SAFE (void *dst, uint64_t value)
 
_MHD_static_inline uint32_t _MHD_ROTR32 (uint32_t value32, int bits)
 
_MHD_static_inline uint32_t _MHD_ROTL32 (uint32_t value32, int bits)
 
_MHD_static_inline uint64_t _MHD_ROTR64 (uint64_t value64, int bits)
 

Detailed Description

macros for bits manipulations

Author
Karlson2k (Evgeny Grin)

Definition in file mhd_bithelpers.h.

Macro Definition Documentation

◆ __has_builtin

#define __has_builtin ( x)    0

Definition at line 44 of file mhd_bithelpers.h.

◆ _MHD_BYTES_SWAP32

#define _MHD_BYTES_SWAP32 ( value32)
Value:
( (((uint32_t) (value32)) << 24) \
| ((((uint32_t) (value32)) & ((uint32_t) 0x0000FF00)) << 8) \
| ((((uint32_t) (value32)) & ((uint32_t) 0x00FF0000)) >> 8) \
| (((uint32_t) (value32)) >> 24) )
#define MHD_HTTP_OK
Definition microhttpd.h:344

Definition at line 66 of file mhd_bithelpers.h.

◆ _MHD_BYTES_SWAP64

#define _MHD_BYTES_SWAP64 ( value64)
Value:
( (((uint64_t) (value64)) << 56) \
| ((((uint64_t) (value64)) & ((uint64_t) 0x000000000000FF00)) << 40) \
| ((((uint64_t) (value64)) & ((uint64_t) 0x0000000000FF0000)) << 24) \
| ((((uint64_t) (value64)) & ((uint64_t) 0x00000000FF000000)) << 8) \
| ((((uint64_t) (value64)) & ((uint64_t) 0x000000FF00000000)) >> 8) \
| ((((uint64_t) (value64)) & ((uint64_t) 0x0000FF0000000000)) >> 24) \
| ((((uint64_t) (value64)) & ((uint64_t) 0x00FF000000000000)) >> 40) \
| (((uint64_t) (value64)) >> 56) )

Definition at line 89 of file mhd_bithelpers.h.

◆ _MHD_GET_32BIT_BE

#define _MHD_GET_32BIT_BE ( addr)
Value:
( (((uint32_t) (((const uint8_t*) addr)[0])) << 24) \
| (((uint32_t) (((const uint8_t*) addr)[1])) << 16) \
| (((uint32_t) (((const uint8_t*) addr)[2])) << 8) \
| ((uint32_t) (((const uint8_t*) addr)[3])) )

Definition at line 295 of file mhd_bithelpers.h.

◆ _MHD_GET_32BIT_BE_UNALIGNED

#define _MHD_GET_32BIT_BE_UNALIGNED   1

Definition at line 301 of file mhd_bithelpers.h.

◆ _MHD_GET_32BIT_LE

#define _MHD_GET_32BIT_LE ( addr)
Value:
( ( (uint32_t) (((const uint8_t*) addr)[0])) \
| (((uint32_t) (((const uint8_t*) addr)[1])) << 8) \
| (((uint32_t) (((const uint8_t*) addr)[2])) << 16) \
| (((uint32_t) (((const uint8_t*) addr)[3])) << 24) )

Definition at line 185 of file mhd_bithelpers.h.

◆ _MHD_GET_32BIT_LE_UNALIGNED

#define _MHD_GET_32BIT_LE_UNALIGNED   1

Definition at line 191 of file mhd_bithelpers.h.

◆ _MHD_GET_64BIT_BE

#define _MHD_GET_64BIT_BE ( addr)
Value:
( (((uint64_t) (((const uint8_t*) addr)[0])) << 56) \
| (((uint64_t) (((const uint8_t*) addr)[1])) << 48) \
| (((uint64_t) (((const uint8_t*) addr)[2])) << 40) \
| (((uint64_t) (((const uint8_t*) addr)[3])) << 32) \
| (((uint64_t) (((const uint8_t*) addr)[4])) << 24) \
| (((uint64_t) (((const uint8_t*) addr)[5])) << 16) \
| (((uint64_t) (((const uint8_t*) addr)[6])) << 8) \
| ((uint64_t) (((const uint8_t*) addr)[7])) )

Definition at line 247 of file mhd_bithelpers.h.

◆ _MHD_GET_64BIT_BE_ALLOW_UNALIGNED

#define _MHD_GET_64BIT_BE_ALLOW_UNALIGNED   1

Definition at line 257 of file mhd_bithelpers.h.

◆ _MHD_has_builtin_dummy

#define _MHD_has_builtin_dummy   1

Definition at line 45 of file mhd_bithelpers.h.

◆ _MHD_PUT_32BIT_BE

#define _MHD_PUT_32BIT_BE ( addr,
value32 )
Value:
do { \
((uint8_t*) (addr))[3] = (uint8_t) ((uint32_t) (value32)); \
((uint8_t*) (addr))[2] = (uint8_t) (((uint32_t) (value32)) >> 8); \
((uint8_t*) (addr))[1] = (uint8_t) (((uint32_t) (value32)) >> 16); \
((uint8_t*) (addr))[0] = (uint8_t) (((uint32_t) (value32)) >> 24); \
} while (0)

Definition at line 273 of file mhd_bithelpers.h.

Referenced by MHD_SHA1_finish(), and MHD_SHA256_finish().

◆ _MHD_PUT_32BIT_BE_UNALIGNED

#define _MHD_PUT_32BIT_BE_UNALIGNED   1

Definition at line 280 of file mhd_bithelpers.h.

◆ _MHD_PUT_32BIT_LE

#define _MHD_PUT_32BIT_LE ( addr,
value32 )
Value:
do { \
((uint8_t*) (addr))[0] = (uint8_t) ((uint32_t) (value32)); \
((uint8_t*) (addr))[1] = (uint8_t) (((uint32_t) (value32)) >> 8); \
((uint8_t*) (addr))[2] = (uint8_t) (((uint32_t) (value32)) >> 16); \
((uint8_t*) (addr))[3] = (uint8_t) (((uint32_t) (value32)) >> 24); \
} while (0)

Definition at line 163 of file mhd_bithelpers.h.

Referenced by MHD_MD5_finish().

◆ _MHD_PUT_32BIT_LE_UNALIGNED

#define _MHD_PUT_32BIT_LE_UNALIGNED   1

Definition at line 170 of file mhd_bithelpers.h.

◆ _MHD_PUT_64BIT_BE

#define _MHD_PUT_64BIT_BE ( addr,
value64 )   _MHD_PUT_64BIT_BE_SLOW(addr, value64)

Definition at line 218 of file mhd_bithelpers.h.

Referenced by _MHD_PUT_64BIT_BE_SAFE(), and MHD_SHA512_256_finish().

◆ _MHD_PUT_64BIT_BE_SLOW

#define _MHD_PUT_64BIT_BE_SLOW ( addr,
value64 )
Value:
do { \
((uint8_t*) (addr))[7] = (uint8_t) ((uint64_t) (value64)); \
((uint8_t*) (addr))[6] = (uint8_t) (((uint64_t) (value64)) >> 8); \
((uint8_t*) (addr))[5] = (uint8_t) (((uint64_t) (value64)) >> 16); \
((uint8_t*) (addr))[4] = (uint8_t) (((uint64_t) (value64)) >> 24); \
((uint8_t*) (addr))[3] = (uint8_t) (((uint64_t) (value64)) >> 32); \
((uint8_t*) (addr))[2] = (uint8_t) (((uint64_t) (value64)) >> 40); \
((uint8_t*) (addr))[1] = (uint8_t) (((uint64_t) (value64)) >> 48); \
((uint8_t*) (addr))[0] = (uint8_t) (((uint64_t) (value64)) >> 56); \
} while (0)

Definition at line 200 of file mhd_bithelpers.h.

Referenced by _MHD_PUT_64BIT_BE_SAFE().

◆ _MHD_PUT_64BIT_BE_UNALIGNED

#define _MHD_PUT_64BIT_BE_UNALIGNED   1

Definition at line 220 of file mhd_bithelpers.h.

◆ _MHD_PUT_64BIT_LE

#define _MHD_PUT_64BIT_LE ( addr,
value64 )
Value:
do { \
((uint8_t*) (addr))[0] = (uint8_t) ((uint64_t) (value64)); \
((uint8_t*) (addr))[1] = (uint8_t) (((uint64_t) (value64)) >> 8); \
((uint8_t*) (addr))[2] = (uint8_t) (((uint64_t) (value64)) >> 16); \
((uint8_t*) (addr))[3] = (uint8_t) (((uint64_t) (value64)) >> 24); \
((uint8_t*) (addr))[4] = (uint8_t) (((uint64_t) (value64)) >> 32); \
((uint8_t*) (addr))[5] = (uint8_t) (((uint64_t) (value64)) >> 40); \
((uint8_t*) (addr))[6] = (uint8_t) (((uint64_t) (value64)) >> 48); \
((uint8_t*) (addr))[7] = (uint8_t) (((uint64_t) (value64)) >> 56); \
} while (0)

Definition at line 124 of file mhd_bithelpers.h.

Referenced by _MHD_PUT_64BIT_LE_SAFE().

◆ _MHD_PUT_64BIT_LE_SLOW

#define _MHD_PUT_64BIT_LE_SLOW ( addr,
value64 )
Value:
do { \
((uint8_t*) (addr))[0] = (uint8_t) ((uint64_t) (value64)); \
((uint8_t*) (addr))[1] = (uint8_t) (((uint64_t) (value64)) >> 8); \
((uint8_t*) (addr))[2] = (uint8_t) (((uint64_t) (value64)) >> 16); \
((uint8_t*) (addr))[3] = (uint8_t) (((uint64_t) (value64)) >> 24); \
((uint8_t*) (addr))[4] = (uint8_t) (((uint64_t) (value64)) >> 32); \
((uint8_t*) (addr))[5] = (uint8_t) (((uint64_t) (value64)) >> 40); \
((uint8_t*) (addr))[6] = (uint8_t) (((uint64_t) (value64)) >> 48); \
((uint8_t*) (addr))[7] = (uint8_t) (((uint64_t) (value64)) >> 56); \
} while (0)

Definition at line 106 of file mhd_bithelpers.h.

Referenced by _MHD_PUT_64BIT_LE_SAFE().

◆ _MHD_PUT_64BIT_LE_UNALIGNED

#define _MHD_PUT_64BIT_LE_UNALIGNED   1

Definition at line 135 of file mhd_bithelpers.h.

Function Documentation

◆ _MHD_PUT_64BIT_BE_SAFE()

_MHD_static_inline void _MHD_PUT_64BIT_BE_SAFE ( void * dst,
uint64_t value )

Definition at line 225 of file mhd_bithelpers.h.

References _MHD_PUT_64BIT_BE, _MHD_PUT_64BIT_BE_SLOW, _MHD_UINT64_ALIGN, and MHD_HTTP_OK.

Referenced by MHD_SHA1_finish(), and MHD_SHA256_finish().

Here is the caller graph for this function:

◆ _MHD_PUT_64BIT_LE_SAFE()

_MHD_static_inline void _MHD_PUT_64BIT_LE_SAFE ( void * dst,
uint64_t value )

Definition at line 140 of file mhd_bithelpers.h.

References _MHD_PUT_64BIT_LE, _MHD_PUT_64BIT_LE_SLOW, _MHD_UINT64_ALIGN, and MHD_HTTP_OK.

Referenced by MHD_MD5_finish().

Here is the caller graph for this function:

◆ _MHD_ROTL32()

_MHD_static_inline uint32_t _MHD_ROTL32 ( uint32_t value32,
int bits )

Rotate left 32-bit value by number of bits. bits parameter must be more than zero and must be less than 32.

Definition at line 352 of file mhd_bithelpers.h.

References MHD_HTTP_OK.

Referenced by calculate_add_nonce_with_retry(), and fast_simple_hash().

Here is the caller graph for this function:

◆ _MHD_ROTR32()

_MHD_static_inline uint32_t _MHD_ROTR32 ( uint32_t value32,
int bits )

Rotate right 32-bit value by number of bits. bits parameter must be more than zero and must be less than 32.

Definition at line 322 of file mhd_bithelpers.h.

References MHD_HTTP_OK.

Referenced by calculate_add_nonce_with_retry().

Here is the caller graph for this function:

◆ _MHD_ROTR64()

_MHD_static_inline uint64_t _MHD_ROTR64 ( uint64_t value64,
int bits )

Rotate right 64-bit value by number of bits. bits parameter must be more than zero and must be less than 64.

Definition at line 382 of file mhd_bithelpers.h.

References MHD_HTTP_OK.