GNU libmicrohttpd 0.9.77
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_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_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)
 

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) )

Definition at line 63 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 85 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 266 of file mhd_bithelpers.h.

◆ _MHD_GET_32BIT_BE_UNALIGNED

#define _MHD_GET_32BIT_BE_UNALIGNED   1

Definition at line 272 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 181 of file mhd_bithelpers.h.

◆ _MHD_GET_32BIT_LE_UNALIGNED

#define _MHD_GET_32BIT_LE_UNALIGNED   1

Definition at line 187 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 244 of file mhd_bithelpers.h.

◆ _MHD_PUT_32BIT_BE_UNALIGNED

#define _MHD_PUT_32BIT_BE_UNALIGNED   1

Definition at line 251 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 159 of file mhd_bithelpers.h.

◆ _MHD_PUT_32BIT_LE_UNALIGNED

#define _MHD_PUT_32BIT_LE_UNALIGNED   1

Definition at line 166 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 214 of file mhd_bithelpers.h.

◆ _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 196 of file mhd_bithelpers.h.

◆ _MHD_PUT_64BIT_BE_UNALIGNED

#define _MHD_PUT_64BIT_BE_UNALIGNED   1

Definition at line 216 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 120 of file mhd_bithelpers.h.

◆ _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 102 of file mhd_bithelpers.h.

◆ _MHD_PUT_64BIT_LE_UNALIGNED

#define _MHD_PUT_64BIT_LE_UNALIGNED   1

Definition at line 131 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 221 of file mhd_bithelpers.h.

References _MHD_PUT_64BIT_BE, _MHD_PUT_64BIT_BE_SLOW, and _MHD_UINT64_ALIGN.

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 136 of file mhd_bithelpers.h.

References _MHD_PUT_64BIT_LE, _MHD_PUT_64BIT_LE_SLOW, and _MHD_UINT64_ALIGN.

Referenced by MHD_MD5Final().

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 321 of file mhd_bithelpers.h.

◆ _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 293 of file mhd_bithelpers.h.