Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void clear_forwarding_mark(int32_t symbol_idx, int32_t interface) {
continue;
}

BITFIELD_CLEAR(lbt_config.loaded_libs[idx]->active_forwards, symbol_idx);
LBT_BITFIELD_CLEAR(lbt_config.loaded_libs[idx]->active_forwards, symbol_idx);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libblastrampoline.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ LBT_DLLEXPORT int32_t lbt_forward(const char * libname, int32_t clear, int32_t v

if (addr != NULL && addr != self_symbol_addr) {
lbt_set_forward_by_index(symbol_idx, addr, interface, complex_retstyle, f2c, verbose);
BITFIELD_SET(forwards, symbol_idx);
LBT_BITFIELD_SET(forwards, symbol_idx);
nforwards++;
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/libblastrampoline.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ extern "C" {
# define LBT_HIDDEN __attribute__ ((visibility("hidden")))
#endif

#define BF_CHUNK(array, idx) (array[((uint32_t)(idx/8))])
#define BF_MASK(idx) ((uint8_t)(0x1 << (idx % 8)))
#define BITFIELD_GET(array, idx) ((BF_CHUNK(array, idx) & BF_MASK(idx)) >> (idx % 8))
#define BITFIELD_CLEAR(array, idx) BF_CHUNK(array, idx) &= ~(BF_MASK(idx))
#define BITFIELD_SET(array, idx) BF_CHUNK(array, idx) |= BF_MASK(idx)
#define LBT_BF_CHUNK(array, idx) (array[((uint32_t)(idx/8))])
#define LBT_BF_MASK(idx) ((uint8_t)(0x1 << (idx % 8)))
#define LBT_BITFIELD_GET(array, idx) ((LBT_BF_CHUNK(array, idx) & LBT_BF_MASK(idx)) >> (idx % 8))
#define LBT_BITFIELD_CLEAR(array, idx) LBT_BF_CHUNK(array, idx) &= ~(LBT_BF_MASK(idx))
#define LBT_BITFIELD_SET(array, idx) LBT_BF_CHUNK(array, idx) |= LBT_BF_MASK(idx)


// The metadata stored on each loaded library
Expand All @@ -55,7 +55,7 @@ typedef struct {
// Common values are `""` or `"64_"`.
const char * suffix;
// bitfield (in uint8_t form) representing the active forwards for this library.
// Use the `BITFIELD_{SET,GET}` macros to look at particular indices within this field.
// Use the `LBT_BITFIELD_{SET,GET}` macros to look at particular indices within this field.
// Note that if you use the footgun API (e.g. "lbt_set_forward()") these values will be
// zeroed out and you must track them manually if you need to.
uint8_t * active_forwards;
Expand Down
Loading