ae2f::Core
Loading...
Searching...
No Matches
BitVec.h File Reference
#include "Cast.h"
#include "Cmp.h"
#include <stdint.h>

Go to the source code of this file.

Macros

#define _ae2f_Macro_BitVec_Filled(len, vec_t)
 Generates the vector filled in 1.
 
#define ae2f_Macro_BitVec_Filled(len)
 Generates the vector filled in 1.
 
#define _ae2f_Macro_BitVec_GetRanged(vector, start, end, vec_t)
 Gets the bits of [vector] between index of [start] and [end].
 
#define ae2f_Macro_BitVec_GetRanged(vector, start, end)
 Gets the bits of [vector] between index of [start] and [end].
It will normalise the values of [start] and [end] by switching them.
 
#define ae2f_Macro_BitVec_Get(vector, idx)
 Gets a bit of [vector] from index of [idx].
 
#define _ae2f_Macro_BitVec_SetRanged(vector, start, end, val, vec_t)
 Sets the bits of [vector] from index of [start] and [end] by [val].
 
#define ae2f_Macro_BitVec_SetRanged(vector, start, end, val)
 Sets the bits of [vector] from index of [start] and [end] by [val].
It will normalise the values of [start] and [end] by switching them.
 
#define ae2f_Macro_BitVec_Set(vector, idx, val)
 Sets a bit of [vector] from index of [idx] by [val].
 

Typedefs

typedef uint8_t ae2f_Macro_BitVecI_t
 The pre-defined index type for Bit vector.
 

Macro Definition Documentation

◆ _ae2f_Macro_BitVec_Filled

#define _ae2f_Macro_BitVec_Filled ( len,
vec_t )
Value:
ae2f_static_cast(vec_t, (sizeof(vec_t) << 3) == (len) ? ae2f_static_cast(vec_t, -1) : (ae2f_static_cast(vec_t, ae2f_static_cast(vec_t, 1) << (len)) - 1))
#define ae2f_static_cast(t, v)
Definition Cast.h:49

Generates the vector filled in 1.

Parameters
lenThe length of the filled vector.
Template Parameters
vec_tThe integer data type.

◆ _ae2f_Macro_BitVec_GetRanged

#define _ae2f_Macro_BitVec_GetRanged ( vector,
start,
end,
vec_t )
Value:
(((vector) >> (start)) & _ae2f_Macro_BitVec_Filled((end) - (start), vec_t))
#define _ae2f_Macro_BitVec_Filled(len, vec_t)
Generates the vector filled in 1.
Definition BitVec.h:15

Gets the bits of [vector] between index of [start] and [end].

Parameters
vector{vec_t} The target for operation.
start{ae2f_Macro_BitVecI_t} The starting index.
end{ae2f_Macro_BitVecI_t} The ending index.
Template Parameters
vec_tThe integer data type.
Warning
[start] greater than [end] may cause undefined behaviour.

◆ _ae2f_Macro_BitVec_SetRanged

#define _ae2f_Macro_BitVec_SetRanged ( vector,
start,
end,
val,
vec_t )
Value:
((vector) & (~((_ae2f_Macro_BitVec_Filled((end) - (start), vec_t)) << start)) | ((val) << start))

Sets the bits of [vector] from index of [start] and [end] by [val].

Parameters
vector{vec_t} The target for operation.
start{ae2f_Macro_BitVecI_t} The starting index.
end{ae2f_Macro_BitVecI_t} The ending index.
val{vec_t} The value to set.
Template Parameters
vec_tThe integer data type.
Warning
[start] greater than [end] may cause undefined behaviour.

◆ ae2f_Macro_BitVec_Filled

#define ae2f_Macro_BitVec_Filled ( len)
Value:

Generates the vector filled in 1.

Parameters
len{ae2f_Macro_BitVecI_t} The length of the filled vector.

◆ ae2f_Macro_BitVec_Get

#define ae2f_Macro_BitVec_Get ( vector,
idx )
Value:
ae2f_Macro_BitVec_GetRanged(vector, idx, (idx) + 1)
#define ae2f_Macro_BitVec_GetRanged(vector, start, end)
Gets the bits of [vector] between index of [start] and [end]. It will normalise the values of [start...
Definition BitVec.h:38

Gets a bit of [vector] from index of [idx].

Parameters
vector{size_t} The target for operation.
idx{ae2f_Macro_BitVecI_t} The wanted index for searching.
See also
ae2f_Macro_BitVec_GetRanged

◆ ae2f_Macro_BitVec_GetRanged

#define ae2f_Macro_BitVec_GetRanged ( vector,
start,
end )
Value:
#define _ae2f_Macro_BitVec_GetRanged(vector, start, end, vec_t)
Gets the bits of [vector] between index of [start] and [end].
Definition BitVec.h:29
#define ae2f_Macro_Cmp_TakeLs(a, b)
Definition Cmp.h:14
#define ae2f_Macro_Cmp_TakeGt(a, b)
Definition Cmp.h:8

Gets the bits of [vector] between index of [start] and [end].
It will normalise the values of [start] and [end] by switching them.

Parameters
vector{size_t} The target for operation.
start{ae2f_Macro_BitVecI_t} The starting index.
end{ae2f_Macro_BitVecI_t} The ending index.
See also
_ae2f_Macro_BitVec_GetRanged

◆ ae2f_Macro_BitVec_Set

#define ae2f_Macro_BitVec_Set ( vector,
idx,
val )
Value:
ae2f_Macro_BitVec_SetRanged(vector, idx, (idx) + 1, val)
#define ae2f_Macro_BitVec_SetRanged(vector, start, end, val)
Sets the bits of [vector] from index of [start] and [end] by [val]. It will normalise the values of ...
Definition BitVec.h:65

Sets a bit of [vector] from index of [idx] by [val].

Parameters
vector{size_t} The target for operation.
idx{bool} The wanted index for searching.
See also
ae2f_Macro_BitVec_GetRanged

◆ ae2f_Macro_BitVec_SetRanged

#define ae2f_Macro_BitVec_SetRanged ( vector,
start,
end,
val )
Value:
#define _ae2f_Macro_BitVec_SetRanged(vector, start, end, val, vec_t)
Sets the bits of [vector] from index of [start] and [end] by [val].
Definition BitVec.h:56
#define ae2f_Macro_BitVec_Filled(len)
Generates the vector filled in 1.
Definition BitVec.h:19
#define ae2f_Macro_Cmp_Diff(a, b)
Definition Cmp.h:18

Sets the bits of [vector] from index of [start] and [end] by [val].
It will normalise the values of [start] and [end] by switching them.

Parameters
vector{vec_t} The target for operation.
start{ae2f_Macro_BitVecI_t} The starting index.
end{ae2f_Macro_BitVecI_t} The ending index.
val{size_t} The value to set.

Typedef Documentation

◆ ae2f_Macro_BitVecI_t

typedef uint8_t ae2f_Macro_BitVecI_t

The pre-defined index type for Bit vector.