Files
2026-07-08 13:55:48 -04:00
..
2026-07-08 13:55:48 -04:00
2026-07-08 13:55:48 -04:00
2026-07-08 13:55:48 -04:00
2026-07-08 13:55:48 -04:00
2026-07-08 13:55:48 -04:00
2026-07-08 13:55:48 -04:00
2026-07-08 13:55:48 -04:00
2026-07-08 13:55:48 -04:00

OPENFLAME Headers

OPENFLAME provides certain capabilities via standalone header files rather than libraries. Aside from the Heap headers, which live in their own directory, OPENFLAME offers four standard headers.

  • bitops.h: Defines macros and inline functions for bit manipulation and other low-level operations.
  • micro64.h: Largely a legacy header, but still needed by bitops.h, it defines fixed-width integer types.
  • multisort.h: A supermacro that can define a sorting function for any user-specified structure type.
  • xorspp.h: Defines a fast, lightweight pseudorandom number generator via inline functions.

Each of these headers has its own manual page. We provide brief descriptions here.

Bitops

This header defines, in a portable way, various operations that can be important for high-performance code, particularly the bit-manipulation instructions like population count. Sometimes they use compiler built-ins; sometimes they are translated directly into machine instructions; and otherwise they are emulated using macros or inline functions. The content of bitops.h is currently divided into seven sections:

  • Bit operations supported on every platform;
  • Special operations supported only on platforms with the necessary hardware instructions;
  • Pseudorandom number generation (brand), efficient and much stronger than an LCG;
  • Prefetch operations that degrade to no-ops on platforms that don't support prefetching;
  • Division by multiplication, to speed up unsigned integer division by run-time constants;
  • Simple timing functions based on clock_gettime;
  • Compiler directives for inline functions and restricted pointers.

Some features of bitops.h, like micro64.h, are subsumed by the C99 standard.

Micro64

This header file provides types for integral types of specific sizes (in bits). In addition it provides compile-time and run-time information to the programmer on the endianness of their platform.

As micro64.h predates C99, it uses type names like int8 and uint64, without the trailing _t. For endianness, it defines exactly one of the two preprocessor symbols M64_BIG_ENDIAN and M64_LITTLE_ENDIAN, and defines two static inline functions m64_little_endian() and m64_little_endian(), each returning a bool.

Multisort

Including multisort.h defines a function for sorting an array of structures on one field. The function can either perform a quicksort using a provided macro for comparison, or a radix-exchange sort on a subset of the bits within a 64-bit integer field. Before including multisort.h, a source file must define symbols such as MS_SORTTYPE and MS_SORTKEY. The name of the function is obtained by prepending ms_sort_ to the value of MS_SORTTYPE, so several "multisort" functions can coexist.

Xorspp

This header defines a suite of functions that implement a fast class of random number generators based on the xor-shift algorithms with 128 bits of state. These algorithms represent a compromise between speed and quality of bits, and are not designed to be cryptographically secure.