COMBINATORIAL_BLAS 1.6
Loading...
Searching...
No Matches
tommytypes.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
Include dependency graph for tommytypes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tommy_node_struct

Macros

#define tommy_cast(type, value)
#define tommy_malloc   malloc
#define tommy_calloc   calloc
#define tommy_realloc   realloc
#define tommy_free   free
#define tommy_inline   static
#define tommy_restrict
#define tommy_likely(x)
#define tommy_unlikely(x)
#define TOMMY_KEY_BIT   (sizeof(tommy_key_t) * 8)
#define TOMMY_ILOG2(value)

Typedefs

typedef struct tommy_node_struct tommy_node

Functions

tommy_inline tommy_uint_t tommy_ilog2_u32 (tommy_uint32_t value)
tommy_inline tommy_uint_t tommy_ctz_u32 (tommy_uint32_t value)
tommy_inline tommy_uint32_t tommy_roundup_pow2_u32 (tommy_uint32_t value)

Detailed Description

Generic types.

Definition in file tommytypes.h.

Macro Definition Documentation

◆ tommy_calloc

#define tommy_calloc   calloc

Definition at line 96 of file tommytypes.h.

◆ tommy_cast

#define tommy_cast ( type,
value )
Value:
(value)

Definition at line 77 of file tommytypes.h.

◆ tommy_free

#define tommy_free   free

Definition at line 102 of file tommytypes.h.

◆ TOMMY_ILOG2

#define TOMMY_ILOG2 ( value)
Value:
((value) == 256 ? 8 : (value) == 128 ? 7 : (value) == 64 ? 6 : (value) == 32 ? 5 : (value) == 16 ? 4 : (value) == 8 ? 3 : (value) == 4 ? 2 : (value) == 2 ? 1 : 0)

Definition at line 306 of file tommytypes.h.

◆ tommy_inline

#define tommy_inline   static

Definition at line 115 of file tommytypes.h.

◆ TOMMY_KEY_BIT

#define TOMMY_KEY_BIT   (sizeof(tommy_key_t) * 8)

Bits into the tommy_key_t type.

Definition at line 165 of file tommytypes.h.

◆ tommy_likely

#define tommy_likely ( x)
Value:
(x)

Definition at line 139 of file tommytypes.h.

◆ tommy_malloc

#define tommy_malloc   malloc

Generic malloc(), calloc(), realloc() and free() functions. Redefine them to what you need. By default they map to the C malloc(), calloc(), realloc() and free().

Definition at line 93 of file tommytypes.h.

◆ tommy_realloc

#define tommy_realloc   realloc

Definition at line 99 of file tommytypes.h.

◆ tommy_restrict

#define tommy_restrict

Definition at line 128 of file tommytypes.h.

◆ tommy_unlikely

#define tommy_unlikely ( x)
Value:
(x)

Definition at line 150 of file tommytypes.h.

Typedef Documentation

◆ tommy_node

typedef struct tommy_node_struct tommy_node

Data structure node. This node type is shared between all the data structures and used to store some info directly into the objects you want to store.

A typical declaration is:

struct object {
tommy_node node;
// other fields
};
struct tommy_node_struct tommy_node

Function Documentation

◆ tommy_ctz_u32()

tommy_inline tommy_uint_t tommy_ctz_u32 ( tommy_uint32_t value)

Bit scan forward or trailing zero count. Return the bit index of the least significant 1 bit.

If no bit is set, the result is undefined.

Parameters
valueValue to scan. 0 is not allowed.
Returns
The index of the least significant bit set.

Definition at line 369 of file tommytypes.h.

◆ tommy_ilog2_u32()

tommy_inline tommy_uint_t tommy_ilog2_u32 ( tommy_uint32_t value)

Bit scan reverse or integer log2. Return the bit index of the most significant 1 bit.

If no bit is set, the result is undefined. To force a return 0 in this case, you can use tommy_ilog2_u32(value | 1).

Other interesting ways for bitscan are at:

Bit Twiddling Hacks http://graphics.stanford.edu/~seander/bithacks.html

Chess Programming BitScan http://chessprogramming.wikispaces.com/BitScan

Parameters
valueValue to scan. 0 is not allowed.
Returns
The index of the most significant bit set.

Definition at line 326 of file tommytypes.h.

◆ tommy_roundup_pow2_u32()

tommy_inline tommy_uint32_t tommy_roundup_pow2_u32 ( tommy_uint32_t value)

Rounds up to the next power of 2. For the value 0, the result is undefined.

Returns
The smallest power of 2 not less than the specified value.

Definition at line 394 of file tommytypes.h.