make style

This commit is contained in:
Philippe Teuwen committed 2026-02-06 13:43:41 +01:00
1 parent 9648c078c1
commit c00e4801b7
48 files changed
+1479 -1490

No files matched your search

+5 -5
View File
@@ -31,13 +31,13 @@
#include <string.h>
#include <stdbool.h>
#if defined(NDEBUG)
#define ASSERT(x) ((void)0)
#define ASSERT(x) ((void)0)
#elif defined(ID48_NO_STDIO)
#define ASSERT(x) ((void)0)
#define ASSERT(x) ((void)0)
#else // neither NDEBUG nor ID48_NO_STDIO defined
#include <stdio.h>
#include <assert.h>
#define ASSERT(x) assert((x))
#include <stdio.h>
#include <assert.h>
#define ASSERT(x) assert((x))
#endif
+69 -71
View File
@@ -45,27 +45,25 @@ SOFTWARE.
*/
#ifndef __has_feature
#define __has_feature(x) 0 /* Compatibility with non-clang compilers. */
#define __has_feature(x) 0 /* Compatibility with non-clang compilers. */
#endif
#if (defined(__cplusplus) && __cplusplus >= 201103L) || /* any compiler claiming C++11 support */ \
(defined(__cplusplus) && _MSC_VER >= 1900 && __cplusplus != 199711L) || /* Visual C++ 2015 or higher */ \
__has_feature(cxx_constexpr) /* CLang versions supporting constexp */
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using C++11 version" )
#endif
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using C++11 version" )
#endif
namespace detail
{
template <typename T, size_t N>
constexpr size_t ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(T const (&)[N]) noexcept
{
return N;
}
} /* namespace detail */
#define ARRAY_SIZE2(arr) detail::ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(arr)
namespace detail {
template <typename T, size_t N>
constexpr size_t ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(T const(&)[N]) noexcept {
return N;
}
} /* namespace detail */
#define ARRAY_SIZE2(arr) detail::ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(arr)
#elif defined(__cplusplus) && __cplusplus >= 199711L && ( /* C++ 98 trick */ \
defined(__INTEL_COMPILER) || \
@@ -75,81 +73,81 @@ SOFTWARE.
(__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
)))
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message "ARRAY_SIZE2 -- Using C++98 version"
#endif
template <typename T, size_t N>
char(&_ArraySizeHelperRequiresArray(T(&)[N]))[N];
#define ARRAY_SIZE2(x) sizeof(_ArraySizeHelperRequiresArray(x))
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message "ARRAY_SIZE2 -- Using C++98 version"
#endif
template <typename T, size_t N>
char(&_ArraySizeHelperRequiresArray(T(&)[N]))[N];
#define ARRAY_SIZE2(x) sizeof(_ArraySizeHelperRequiresArray(x))
#elif defined(__cplusplus) /* && ((__cplusplus >= 199711L) || defined(__INTEL_COMPILER) || defined(__clang__)) */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using Ivan J. Johnson's C++ version" )
#endif
/*
Works on older compilers, even Visual C++ 6....
Created by Ivan J. Johnson, March 06, 2007
See http://drdobbs.com/cpp/197800525?pgno=1
Full description is in markdown file array_size2.md
*/
#define ARRAY_SIZE2(arr) ( \
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using Ivan J. Johnson's C++ version" )
#endif
/*
Works on older compilers, even Visual C++ 6....
Created by Ivan J. Johnson, March 06, 2007
See http://drdobbs.com/cpp/197800525?pgno=1
Full description is in markdown file array_size2.md
*/
#define ARRAY_SIZE2(arr) ( \
0 * sizeof(reinterpret_cast<const ::Bad_arg_to_ARRAY_SIZE2*>(arr)) + /*check1*/ \
0 * sizeof(::Bad_arg_to_ARRAY_SIZE2::check_type((arr), &(arr))) + /*check2*/ \
sizeof(arr) / sizeof((arr)[0]) /* eval */ \
)
struct Bad_arg_to_ARRAY_SIZE2 {
class Is_pointer; /* incomplete */
class Is_array {};
template <typename T>
static Is_pointer check_type(T const *, T const * const *);
static Is_array check_type(void const *, void const *);
};
struct Bad_arg_to_ARRAY_SIZE2 {
class Is_pointer; /* incomplete */
class Is_array {};
template <typename T>
static Is_pointer check_type(T const *, T const * const *);
static Is_array check_type(void const *, void const *);
};
#elif !defined(__cplusplus) && defined(__GNUC__)
#include <stdint.h>
#include <stdint.h>
/**
Even C can have type-safety for equivalent of ARRAY_SIZE() macro,
when using the following two GCC extensions:
typeof()
__builtin_types_compatible_p()
*/
/**
Even C can have type-safety for equivalent of ARRAY_SIZE() macro,
when using the following two GCC extensions:
typeof()
__builtin_types_compatible_p()
*/
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using GNUC version" )
#endif
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using GNUC version" )
#endif
/**
validated using:
MSP430 gcc 4.5.3
x86-64 icc 16.0.3
x86-64 gcc 4.1.2
x86-64 clang 3.0.0
AVR gcc 4.5.4
ARM gcc 4.5.4
*/
/**
validated using:
MSP430 gcc 4.5.3
x86-64 icc 16.0.3
x86-64 gcc 4.1.2
x86-64 clang 3.0.0
AVR gcc 4.5.4
ARM gcc 4.5.4
*/
#define __SIMPLEHACKS_COMPATIBLE_TYPES__(a,b) __builtin_types_compatible_p(__typeof__(a), __typeof__(b)) /* GCC extensions */
#define __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(x) (sizeof(struct { uint8_t q: (-!!(x)*0x1ee7)+1u;})-1u) /* if x is zero, reports "error: negative width in bit-field '<anonymous>'" */
#define __SIMPLEHACKS_MUST_BE_ARRAY__(x) __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(__SIMPLEHACKS_COMPATIBLE_TYPES__((x), &(*x)))
#define ARRAY_SIZE2(_arr) ( (sizeof(_arr) / sizeof((_arr)[0])) + __SIMPLEHACKS_MUST_BE_ARRAY__(_arr) ) /* compile-time error if not an array */
#define __SIMPLEHACKS_COMPATIBLE_TYPES__(a,b) __builtin_types_compatible_p(__typeof__(a), __typeof__(b)) /* GCC extensions */
#define __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(x) (sizeof(struct { uint8_t q: (-!!(x)*0x1ee7)+1u;})-1u) /* if x is zero, reports "error: negative width in bit-field '<anonymous>'" */
#define __SIMPLEHACKS_MUST_BE_ARRAY__(x) __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(__SIMPLEHACKS_COMPATIBLE_TYPES__((x), &(*x)))
#define ARRAY_SIZE2(_arr) ( (sizeof(_arr) / sizeof((_arr)[0])) + __SIMPLEHACKS_MUST_BE_ARRAY__(_arr) ) /* compile-time error if not an array */
#else
/**
The good news is that all compilers (as of 20202-05-08)
on godbolt.org are fully supported. Therefore, if some
other compiler does not support any of the above method,
it's important to force a compile-time error, to avoid
any suggestion that this provides a safe macro.
*/
#error "Unable to provide type-safe ARRAY_SIZE2 macro"
/**
The good news is that all compilers (as of 20202-05-08)
on godbolt.org are fully supported. Therefore, if some
other compiler does not support any of the above method,
it's important to force a compile-time error, to avoid
any suggestion that this provides a safe macro.
*/
#error "Unable to provide type-safe ARRAY_SIZE2 macro"
#endif
+2 -2
View File
@@ -13,8 +13,8 @@ int main(void) {
printf("Verifying Espresso Results...\n");
result = verify_espresso_results();
printf("Verifying Espresso Results: %s\n",
result ? "SUCCESS" : "----> FAILURE <----"
);
result ? "SUCCESS" : "----> FAILURE <----"
);
}
// if (result) {
// printf("Hello2...\n");
+232 -240
View File
@@ -9,78 +9,78 @@
#include "verify_espresso.h"
#if !defined true
#define true ((bool)1u)
#define true ((bool)1u)
#endif
#if !defined false
#define false ((bool)0u)
#define false ((bool)0u)
#endif
#if 1 // constant names for use in LUT_PLA_NAMES_xx
static const char * const NAME_A = "a";
static const char * const NAME_B = "b";
static const char * const NAME_C = "c";
static const char * const NAME_L0 = "l0";
static const char * const NAME_L2 = "l2";
static const char * const NAME_L3 = "l3";
static const char * const NAME_L4 = "l4";
static const char * const NAME_L5 = "l5";
static const char * const NAME_L6 = "l6";
static const char * const NAME_M0 = "m0";
static const char * const NAME_M1 = "m1";
static const char * const NAME_M3 = "m3";
static const char * const NAME_M5 = "m5";
static const char * const NAME_R0 = "r0";
static const char * const NAME_R1 = "r1";
static const char * const NAME_R2 = "r2";
static const char * const NAME_R3 = "r3";
static const char * const NAME_R4 = "r4";
static const char * const NAME_R5 = "r5";
static const char * const NAME_R6 = "r6";
static const char *const NAME_A = "a";
static const char *const NAME_B = "b";
static const char *const NAME_C = "c";
static const char *const NAME_L0 = "l0";
static const char *const NAME_L2 = "l2";
static const char *const NAME_L3 = "l3";
static const char *const NAME_L4 = "l4";
static const char *const NAME_L5 = "l5";
static const char *const NAME_L6 = "l6";
static const char *const NAME_M0 = "m0";
static const char *const NAME_M1 = "m1";
static const char *const NAME_M3 = "m3";
static const char *const NAME_M5 = "m5";
static const char *const NAME_R0 = "r0";
static const char *const NAME_R1 = "r1";
static const char *const NAME_R2 = "r2";
static const char *const NAME_R3 = "r3";
static const char *const NAME_R4 = "r4";
static const char *const NAME_R5 = "r5";
static const char *const NAME_R6 = "r6";
#endif // constant names for use in LUT_PLA_NAMES_xx
#if 1 // LUT_PLA_NAMES_xx -- name arrays for generating espresso input files
// NOTE: these arrays are in order of the most significant to least significant bit.
// did i get confused by that?
const char * const LUT_PLA_NAMES_g1[5] = { NAME_A , NAME_L2, NAME_L3, NAME_L0, NAME_L6, };
const char * const LUT_PLA_NAMES_g2[5] = { NAME_L5, NAME_B , NAME_M0, NAME_L4, NAME_M1, };
const char * const LUT_PLA_NAMES_g3[5] = { NAME_M5, NAME_C , NAME_R1, NAME_M3, NAME_R3, };
const char * const LUT_PLA_NAMES_g4[5] = { NAME_R2, NAME_R4, NAME_R6, NAME_R0, NAME_R5, };
const char * const LUT_PLA_NAMES_XX[8] = {
NAME_L0, NAME_L4, NAME_L6, NAME_M1,
NAME_M3, NAME_R0, NAME_R3, NAME_R5,
};
// NOTE: these arrays are in order of the most significant to least significant bit.
// did i get confused by that?
const char *const LUT_PLA_NAMES_g1[5] = { NAME_A, NAME_L2, NAME_L3, NAME_L0, NAME_L6, };
const char *const LUT_PLA_NAMES_g2[5] = { NAME_L5, NAME_B, NAME_M0, NAME_L4, NAME_M1, };
const char *const LUT_PLA_NAMES_g3[5] = { NAME_M5, NAME_C, NAME_R1, NAME_M3, NAME_R3, };
const char *const LUT_PLA_NAMES_g4[5] = { NAME_R2, NAME_R4, NAME_R6, NAME_R0, NAME_R5, };
const char *const LUT_PLA_NAMES_XX[8] = {
NAME_L0, NAME_L4, NAME_L6, NAME_M1,
NAME_M3, NAME_R0, NAME_R3, NAME_R5,
};
#endif // LUT_PLA_NAMES_xx -- name arrays for generating espresso input files
#if 1 // actual lookup tables
// LUTs were internal-only, and not even exposed to library internals.
// so just copy/paste here for now for initial testing
/// initial_idx = (l0 << 7) | (l4 << 6) | (l6 << 5) | (m1 << 4) | (m3 << 3) | (r0 << 2) | (r3 << 1) | (r5 << 0)
static const uint8_t small_lut_XX[32] = { // aka 256 bits
0x44, 0xff, 0x4f, 0x4f, 0x55, 0xff, 0x55, 0x55,
0xcc, 0xff, 0xcf, 0x4f, 0xcc, 0xff, 0xcc, 0x44,
0x00, 0x00, 0x0f, 0x0f, 0x55, 0x55, 0x55, 0x55,
0xcc, 0x00, 0xcf, 0x0f, 0xcc, 0x00, 0xcc, 0x00,
};
/// g1_idx = (a << 4) | (l2 << 3) | (l3 << 2) | (l0 << 1) | (l6 << 0)
static const uint8_t small_lut_group1[4] = { // aka 32 bits
0x4f, 0x92, 0xa1, 0x7c,
};
/// g2_idx = (l5 << 4) | (b << 3) | (m0 << 2) | (l4 << 1) | (m1 << 0)
static const uint8_t small_lut_group2[4] = { // aka 32 bits
0x8f, 0x52, 0x61, 0xbc,
};
/// g3_idx = (m5 << 4) | (c << 3) | (r1 << 2) | (m3 << 1) | (r3 << 0)
static const uint8_t small_lut_group3[4] = { // aka 32 bits
0x8f, 0x34, 0x61, 0xda,
};
/// g4_idx = (r2 << 4) | (r4 << 3) | (r6 << 2) | (r0 << 1) | (r5 << 0)
static const uint8_t small_lut_group4[4] = { // aka 32 bits
0x8f, 0x34, 0x52, 0xe9,
};
static inline bool get_bit(const uint8_t *table_start, uint32_t bit_idx) {
const uint32_t byte = bit_idx / 8u;
const uint8_t mask = 1u << (bit_idx % 8u);
return (table_start[byte] & mask) != 0;
}
// LUTs were internal-only, and not even exposed to library internals.
// so just copy/paste here for now for initial testing
/// initial_idx = (l0 << 7) | (l4 << 6) | (l6 << 5) | (m1 << 4) | (m3 << 3) | (r0 << 2) | (r3 << 1) | (r5 << 0)
static const uint8_t small_lut_XX[32] = { // aka 256 bits
0x44, 0xff, 0x4f, 0x4f, 0x55, 0xff, 0x55, 0x55,
0xcc, 0xff, 0xcf, 0x4f, 0xcc, 0xff, 0xcc, 0x44,
0x00, 0x00, 0x0f, 0x0f, 0x55, 0x55, 0x55, 0x55,
0xcc, 0x00, 0xcf, 0x0f, 0xcc, 0x00, 0xcc, 0x00,
};
/// g1_idx = (a << 4) | (l2 << 3) | (l3 << 2) | (l0 << 1) | (l6 << 0)
static const uint8_t small_lut_group1[4] = { // aka 32 bits
0x4f, 0x92, 0xa1, 0x7c,
};
/// g2_idx = (l5 << 4) | (b << 3) | (m0 << 2) | (l4 << 1) | (m1 << 0)
static const uint8_t small_lut_group2[4] = { // aka 32 bits
0x8f, 0x52, 0x61, 0xbc,
};
/// g3_idx = (m5 << 4) | (c << 3) | (r1 << 2) | (m3 << 1) | (r3 << 0)
static const uint8_t small_lut_group3[4] = { // aka 32 bits
0x8f, 0x34, 0x61, 0xda,
};
/// g4_idx = (r2 << 4) | (r4 << 3) | (r6 << 2) | (r0 << 1) | (r5 << 0)
static const uint8_t small_lut_group4[4] = { // aka 32 bits
0x8f, 0x34, 0x52, 0xe9,
};
static inline bool get_bit(const uint8_t *table_start, uint32_t bit_idx) {
const uint32_t byte = bit_idx / 8u;
const uint8_t mask = 1u << (bit_idx % 8u);
return (table_start[byte] & mask) != 0;
}
#endif // actual lookup tables
@@ -217,9 +217,9 @@ typedef struct _INDEX_XX {
typedef struct _ESPRESSO_GENERATOR_ARGUMENTS {
uint8_t const input_count;
char const * const * names;
char const * const output_name;
uint8_t const * lut_start;
char const *const *names;
char const *const output_name;
uint8_t const *lut_start;
} ESPRESSO_GENERATOR_ARGUMENTS;
static bool verify_lut_g1(void);
@@ -243,16 +243,16 @@ static bool espresso_implementation_g1_alt0(uint8_t idx) {
bool l0 = idx & (1u << 1);
bool l6 = idx & (1u << 0);
return
( a && l2 && _ && l0 && !(l6) ) ||
( a && _ && l3 && !(l0) && l6 ) ||
( !(a) && !(l2) && !(l3) && _ && _ ) ||
( _ && !(l2) && !(l3) && !(l0) && !(l6) ) ||
( _ && l2 && l3 && !(l0) && !(l6) ) ||
( !(a) && !(l2) && _ && l0 && !(l6) ) ||
( !(a) && _ && !(l3) && !(l0) && l6 ) ||
( a && l2 && !(l3) && l0 && _ ) ||
( a && !(l2) && l3 && _ && l6 ) ||
( !(a) && l2 && l3 && l0 && l6 ) ;
(a && l2 && _ && l0 && !(l6)) ||
(a && _ && l3 && !(l0) && l6) ||
(!(a) && !(l2) && !(l3) && _ && _) ||
(_ && !(l2) && !(l3) && !(l0) && !(l6)) ||
(_ && l2 && l3 && !(l0) && !(l6)) ||
(!(a) && !(l2) && _ && l0 && !(l6)) ||
(!(a) && _ && !(l3) && !(l0) && l6) ||
(a && l2 && !(l3) && l0 && _) ||
(a && !(l2) && l3 && _ && l6) ||
(!(a) && l2 && l3 && l0 && l6) ;
}
static bool espresso_implementation_g1_alt1(uint8_t idx) {
// output_g1 = (a&l2&l0&!l6) | (a&l3&!l0&l6) | (!a&!l2&!l3) | (!l2&!l3&!l0&!l6) | (l2&l3&!l0&!l6) | (!a&!l2&l0&!l6) | (!a&!l3&!l0&l6) | (a&l2&!l3&l0) | (a&!l2&l3&l6) | (!a&l2&l3&l0&l6);
@@ -264,16 +264,16 @@ static bool espresso_implementation_g1_alt1(uint8_t idx) {
bool l0 = t.l0;
bool l6 = t.l6;
return
( a && l0 && l2 && _ && !(l6) ) ||
( a && !(l0) && _ && l3 && l6 ) ||
( !(a) && _ && !(l2) && !(l3) && _ ) ||
( _ && !(l0) && !(l2) && !(l3) && !(l6) ) ||
( _ && !(l0) && l2 && l3 && !(l6) ) ||
( !(a) && l0 && !(l2) && _ && !(l6) ) ||
( !(a) && !(l0) && _ && !(l3) && l6 ) ||
( a && l0 && l2 && !(l3) && _ ) ||
( a && _ && !(l2) && l3 && l6 ) ||
( !(a) && l0 && l2 && l3 && l6 ) ;
(a && l0 && l2 && _ && !(l6)) ||
(a && !(l0) && _ && l3 && l6) ||
(!(a) && _ && !(l2) && !(l3) && _) ||
(_ && !(l0) && !(l2) && !(l3) && !(l6)) ||
(_ && !(l0) && l2 && l3 && !(l6)) ||
(!(a) && l0 && !(l2) && _ && !(l6)) ||
(!(a) && !(l0) && _ && !(l3) && l6) ||
(a && l0 && l2 && !(l3) && _) ||
(a && _ && !(l2) && l3 && l6) ||
(!(a) && l0 && l2 && l3 && l6) ;
}
static const lookuptable_func_t alt_for_g1[] = {
espresso_implementation_g1_alt0,
@@ -290,17 +290,17 @@ static bool espresso_implementation_g2_alt0(uint8_t idx) {
bool l4 = idx & (1u << 1);
bool m1 = idx & (1u << 0);
static const bool _ = true;
return
( _ && b && m0 && !(l4) && !(m1) ) |
( l5 && b && _ && l4 && m1 ) |
( !(l5) && !(b) && !(m0) && _ && _ ) |
( _ && !(b) && !(m0) && !(l4) && !(m1) ) |
( l5 && b && !(m0) && l4 && _ ) |
( l5 && !(b) && m0 && l4 && !(m1) ) |
( !(l5) && b && m0 && _ && !(m1) ) |
( !(l5) && _ && !(m0) && !(l4) && m1 ) |
( l5 && _ && m0 && !(l4) && m1 ) |
( !(l5) && !(b) && _ && l4 && m1 ) ;
return
(_ && b && m0 && !(l4) && !(m1)) |
(l5 && b && _ && l4 && m1) |
(!(l5) && !(b) && !(m0) && _ && _) |
(_ && !(b) && !(m0) && !(l4) && !(m1)) |
(l5 && b && !(m0) && l4 && _) |
(l5 && !(b) && m0 && l4 && !(m1)) |
(!(l5) && b && m0 && _ && !(m1)) |
(!(l5) && _ && !(m0) && !(l4) && m1) |
(l5 && _ && m0 && !(l4) && m1) |
(!(l5) && !(b) && _ && l4 && m1) ;
}
static bool espresso_implementation_g2_alt1(uint8_t idx) {
// output_g2 = (b&m0&!l4&!m1) | (l5&b&l4&m1) | (!l5&!b&!m0) | (!b&!m0&!l4&!m1) | (l5&b&!m0&l4) | (l5&!b&m0&l4&!m1) | (!l5&b&m0&!m1) | (!l5&!m0&!l4&m1) | (l5&m0&!l4&m1) | (!l5&!b&l4&m1);
@@ -311,17 +311,17 @@ static bool espresso_implementation_g2_alt1(uint8_t idx) {
bool l4 = t.l4;
bool m1 = t.m1;
static const bool _ = true;
return
( _ && b && m0 && !(l4) && !(m1) ) |
( l5 && b && _ && l4 && m1 ) |
( !(l5) && !(b) && !(m0) && _ && _ ) |
( _ && !(b) && !(m0) && !(l4) && !(m1) ) |
( l5 && b && !(m0) && l4 && _ ) |
( l5 && !(b) && m0 && l4 && !(m1) ) |
( !(l5) && b && m0 && _ && !(m1) ) |
( !(l5) && _ && !(m0) && !(l4) && m1 ) |
( l5 && _ && m0 && !(l4) && m1 ) |
( !(l5) && !(b) && _ && l4 && m1 ) ;
return
(_ && b && m0 && !(l4) && !(m1)) |
(l5 && b && _ && l4 && m1) |
(!(l5) && !(b) && !(m0) && _ && _) |
(_ && !(b) && !(m0) && !(l4) && !(m1)) |
(l5 && b && !(m0) && l4 && _) |
(l5 && !(b) && m0 && l4 && !(m1)) |
(!(l5) && b && m0 && _ && !(m1)) |
(!(l5) && _ && !(m0) && !(l4) && m1) |
(l5 && _ && m0 && !(l4) && m1) |
(!(l5) && !(b) && _ && l4 && m1) ;
}
static const lookuptable_func_t alt_for_g2[] = {
@@ -341,16 +341,16 @@ static bool espresso_implementation_g3_alt0(uint8_t idx) {
bool r3 = idx & (1u << 0);
static const bool _ = true;
return
( _ && c && r1 && !(m3) && !(r3) ) ||
( m5 && c && _ && m3 && r3 ) ||
( !(m5) && !(c) && !(r1) && _ && _ ) ||
( _ && !(c) && !(r1) && !(m3) && !(r3) ) ||
( !(m5) && _ && !(r1) && m3 && !(r3) ) ||
( m5 && _ && r1 && m3 && !(r3) ) ||
( m5 && c && !(r1) && _ && r3 ) ||
( m5 && !(c) && r1 && !(m3) && r3 ) ||
( !(m5) && c && r1 && !(m3) && _ ) ||
( !(m5) && !(c) && _ && m3 && r3 ) ;
(_ && c && r1 && !(m3) && !(r3)) ||
(m5 && c && _ && m3 && r3) ||
(!(m5) && !(c) && !(r1) && _ && _) ||
(_ && !(c) && !(r1) && !(m3) && !(r3)) ||
(!(m5) && _ && !(r1) && m3 && !(r3)) ||
(m5 && _ && r1 && m3 && !(r3)) ||
(m5 && c && !(r1) && _ && r3) ||
(m5 && !(c) && r1 && !(m3) && r3) ||
(!(m5) && c && r1 && !(m3) && _) ||
(!(m5) && !(c) && _ && m3 && r3) ;
}
static bool espresso_implementation_g3_alt1(uint8_t idx) {
// output_g3 = (c&r1&!m3&!r3) | (m5&c&m3&r3) | (!m5&!c&!r1) | (!c&!r1&!m3&!r3) | (!m5&!r1&m3&!r3) | (m5&r1&m3&!r3) | (m5&c&!r1&r3) | (m5&!c&r1&!m3&r3) | (!m5&c&r1&!m3) | (!m5&!c&m3&r3);
@@ -362,16 +362,16 @@ static bool espresso_implementation_g3_alt1(uint8_t idx) {
bool m5 = t.m5;
static const bool _ = true;
return
( _ && c && r1 && !(m3) && !(r3) ) ||
( m5 && c && _ && m3 && r3 ) ||
( !(m5) && !(c) && !(r1) && _ && _ ) ||
( _ && !(c) && !(r1) && !(m3) && !(r3) ) ||
( !(m5) && _ && !(r1) && m3 && !(r3) ) ||
( m5 && _ && r1 && m3 && !(r3) ) ||
( m5 && c && !(r1) && _ && r3 ) ||
( m5 && !(c) && r1 && !(m3) && r3 ) ||
( !(m5) && c && r1 && !(m3) && _ ) ||
( !(m5) && !(c) && _ && m3 && r3 ) ;
(_ && c && r1 && !(m3) && !(r3)) ||
(m5 && c && _ && m3 && r3) ||
(!(m5) && !(c) && !(r1) && _ && _) ||
(_ && !(c) && !(r1) && !(m3) && !(r3)) ||
(!(m5) && _ && !(r1) && m3 && !(r3)) ||
(m5 && _ && r1 && m3 && !(r3)) ||
(m5 && c && !(r1) && _ && r3) ||
(m5 && !(c) && r1 && !(m3) && r3) ||
(!(m5) && c && r1 && !(m3) && _) ||
(!(m5) && !(c) && _ && m3 && r3) ;
}
static const lookuptable_func_t alt_for_g3[] = {
@@ -389,16 +389,16 @@ static bool espresso_implementation_g4_alt0(uint8_t idx) {
bool r5 = idx & (1u << 0);
static const bool _ = true;
return
( r2 && _ && r6 && r0 && !(r5) ) |
( _ && r4 && r6 && !(r0) && r5 ) |
( !(r2) && !(r4) && !(r6) && _ && _ ) |
( r2 && r4 && !(r6) && !(r0) && !(r5) ) |
( r2 && !(r4) && r6 && _ && !(r5) ) |
( !(r2) && r4 && r6 && !(r0) && _ ) |
( !(r2) && _ && !(r6) && r0 && !(r5) ) |
( _ && !(r4) && !(r6) && !(r0) && r5 ) |
( r2 && r4 && _ && r0 && r5 ) |
( !(r2) && !(r4) && _ && r0 && r5 ) ;
(r2 && _ && r6 && r0 && !(r5)) |
(_ && r4 && r6 && !(r0) && r5) |
(!(r2) && !(r4) && !(r6) && _ && _) |
(r2 && r4 && !(r6) && !(r0) && !(r5)) |
(r2 && !(r4) && r6 && _ && !(r5)) |
(!(r2) && r4 && r6 && !(r0) && _) |
(!(r2) && _ && !(r6) && r0 && !(r5)) |
(_ && !(r4) && !(r6) && !(r0) && r5) |
(r2 && r4 && _ && r0 && r5) |
(!(r2) && !(r4) && _ && r0 && r5) ;
}
static bool espresso_implementation_g4_alt1(uint8_t idx) {
// output_g4 = (r2&r6&r0&!r5) | (r4&r6&!r0&r5) | (!r2&!r4&!r6) | (r2&r4&!r6&!r0&!r5) | (r2&!r4&r6&!r5) | (!r2&r4&r6&!r0) | (!r2&!r6&r0&!r5) | (!r4&!r6&!r0&r5) | (r2&r4&r0&r5) | (!r2&!r4&r0&r5);
@@ -411,16 +411,16 @@ static bool espresso_implementation_g4_alt1(uint8_t idx) {
bool r5 = t.r5;
static const bool _ = true;
return
( r2 && _ && r6 && r0 && !(r5) ) |
( _ && r4 && r6 && !(r0) && r5 ) |
( !(r2) && !(r4) && !(r6) && _ && _ ) |
( r2 && r4 && !(r6) && !(r0) && !(r5) ) |
( r2 && !(r4) && r6 && _ && !(r5) ) |
( !(r2) && r4 && r6 && !(r0) && _ ) |
( !(r2) && _ && !(r6) && r0 && !(r5) ) |
( _ && !(r4) && !(r6) && !(r0) && r5 ) |
( r2 && r4 && _ && r0 && r5 ) |
( !(r2) && !(r4) && _ && r0 && r5 ) ;
(r2 && _ && r6 && r0 && !(r5)) |
(_ && r4 && r6 && !(r0) && r5) |
(!(r2) && !(r4) && !(r6) && _ && _) |
(r2 && r4 && !(r6) && !(r0) && !(r5)) |
(r2 && !(r4) && r6 && _ && !(r5)) |
(!(r2) && r4 && r6 && !(r0) && _) |
(!(r2) && _ && !(r6) && r0 && !(r5)) |
(_ && !(r4) && !(r6) && !(r0) && r5) |
(r2 && r4 && _ && r0 && r5) |
(!(r2) && !(r4) && _ && r0 && r5) ;
}
static const lookuptable_func_t alt_for_g4[] = {
@@ -442,11 +442,11 @@ static bool espresso_implementation_xx_alt0(uint8_t idx) {
bool r5 = idx & (1u << 0);
return
( _ && _ && !(l6) && m1 && _ && !(r0) && _ && _ ) ||
( _ && l4 && _ && _ && !(m3) && _ && r3 && _ ) ||
( _ && !(l4) && l6 && _ && _ && _ && _ && !(r5) ) ||
( !(l0) && _ && _ && !(m1) && m3 && _ && _ && _ ) ||
( !(l0) && _ && _ && _ && _ && _ && r3 && !(r5) ) ;
(_ && _ && !(l6) && m1 && _ && !(r0) && _ && _) ||
(_ && l4 && _ && _ && !(m3) && _ && r3 && _) ||
(_ && !(l4) && l6 && _ && _ && _ && _ && !(r5)) ||
(!(l0) && _ && _ && !(m1) && m3 && _ && _ && _) ||
(!(l0) && _ && _ && _ && _ && _ && r3 && !(r5)) ;
}
static bool espresso_implementation_xx_alt1(uint8_t idx) {
// output_XX = (!l6&m1&!r0) | (l4&!m3&r3) | (!l4&l6&!r5) | (!l0&!m1&m3) | (!l0&r3&!r5);
@@ -462,11 +462,11 @@ static bool espresso_implementation_xx_alt1(uint8_t idx) {
bool r3 = t.r3;
bool r5 = t.r5;
return
( _ && _ && !(l6) && m1 && _ && !(r0) && _ && _ ) ||
( _ && l4 && _ && _ && !(m3) && _ && r3 && _ ) ||
( _ && !(l4) && l6 && _ && _ && _ && _ && !(r5) ) ||
( !(l0) && _ && _ && !(m1) && m3 && _ && _ && _ ) ||
( !(l0) && _ && _ && _ && _ && _ && r3 && !(r5) ) ;
(_ && _ && !(l6) && m1 && _ && !(r0) && _ && _) ||
(_ && l4 && _ && _ && !(m3) && _ && r3 && _) ||
(_ && !(l4) && l6 && _ && _ && _ && _ && !(r5)) ||
(!(l0) && _ && _ && !(m1) && m3 && _ && _ && _) ||
(!(l0) && _ && _ && _ && _ && _ && r3 && !(r5)) ;
}
static const lookuptable_func_t alt_for_xx[] = {
@@ -478,10 +478,10 @@ static const lookuptable_func_t alt_for_xx[] = {
typedef struct _VERIFICATION_T {
uint8_t const input_count;
char const * const * names;
char const * const output_name;
uint8_t const * lut_start;
lookuptable_func_t const * const altFns;
char const *const *names;
char const *const output_name;
uint8_t const *lut_start;
lookuptable_func_t const *const altFns;
size_t const altFnCount;
} VERIFICATION_T;
@@ -491,7 +491,7 @@ VERIFICATION_T const verification_table[] = {
{ .input_count = 5, .names = LUT_PLA_NAMES_g2, .output_name = "g2", .lut_start = small_lut_group2, .altFns = alt_for_g2, .altFnCount = ARRAY_SIZE2(alt_for_g2) },
{ .input_count = 5, .names = LUT_PLA_NAMES_g3, .output_name = "g3", .lut_start = small_lut_group3, .altFns = alt_for_g3, .altFnCount = ARRAY_SIZE2(alt_for_g3) },
{ .input_count = 5, .names = LUT_PLA_NAMES_g4, .output_name = "g4", .lut_start = small_lut_group4, .altFns = alt_for_g4, .altFnCount = ARRAY_SIZE2(alt_for_g4) },
{ .input_count = 8, .names = LUT_PLA_NAMES_XX, .output_name = "xx", .lut_start = small_lut_XX , .altFns = alt_for_xx, .altFnCount = ARRAY_SIZE2(alt_for_xx) },
{ .input_count = 8, .names = LUT_PLA_NAMES_XX, .output_name = "xx", .lut_start = small_lut_XX, .altFns = alt_for_xx, .altFnCount = ARRAY_SIZE2(alt_for_xx) },
};
@@ -499,84 +499,83 @@ static bool espresso_implementation_g1(bool a, bool l0, bool l2, bool l3, bool
// output_g1 = (a&l2&l0&!l6) | (a&l3&!l0&l6) | (!a&!l2&!l3) | (!l2&!l3&!l0&!l6) | (l2&l3&!l0&!l6) | (!a&!l2&l0&!l6) | (!a&!l3&!l0&l6) | (a&l2&!l3&l0) | (a&!l2&l3&l6) | (!a&l2&l3&l0&l6);
static const bool _ = true;
return
( a && l0 && l2 && _ && !(l6) ) |
( a && !(l0) && _ && l3 && l6 ) |
( !(a) && _ && !(l2) && !(l3) && _ ) |
( _ && !(l0) && !(l2) && !(l3) && !(l6) ) |
( _ && !(l0) && l2 && l3 && !(l6) ) |
( !(a) && l0 && !(l2) && _ && !(l6) ) |
( !(a) && !(l0) && _ && !(l3) && l6 ) |
( a && l0 && l2 && !(l3) && _ ) |
( a && _ && !(l2) && l3 && l6 ) |
( !(a) && l0 && l2 && l3 && l6 ) ;
(a && l0 && l2 && _ && !(l6)) |
(a && !(l0) && _ && l3 && l6) |
(!(a) && _ && !(l2) && !(l3) && _) |
(_ && !(l0) && !(l2) && !(l3) && !(l6)) |
(_ && !(l0) && l2 && l3 && !(l6)) |
(!(a) && l0 && !(l2) && _ && !(l6)) |
(!(a) && !(l0) && _ && !(l3) && l6) |
(a && l0 && l2 && !(l3) && _) |
(a && _ && !(l2) && l3 && l6) |
(!(a) && l0 && l2 && l3 && l6) ;
}
static bool espresso_implementation_g2(bool b, bool l4, bool l5, bool m0, bool m1) {
// output_g2 = (b&m0&!l4&!m1) | (l5&b&l4&m1) | (!l5&!b&!m0) | (!b&!m0&!l4&!m1) | (l5&b&!m0&l4) | (l5&!b&m0&l4&!m1) | (!l5&b&m0&!m1) | (!l5&!m0&!l4&m1) | (l5&m0&!l4&m1) | (!l5&!b&l4&m1);
static const bool _ = true;
return
( _ && b && m0 && !(l4) && !(m1) ) |
( l5 && b && _ && l4 && m1 ) |
( !(l5) && !(b) && !(m0) && _ && _ ) |
( _ && !(b) && !(m0) && !(l4) && !(m1) ) |
( l5 && b && !(m0) && l4 && _ ) |
( l5 && !(b) && m0 && l4 && !(m1) ) |
( !(l5) && b && m0 && _ && !(m1) ) |
( !(l5) && _ && !(m0) && !(l4) && m1 ) |
( l5 && _ && m0 && !(l4) && m1 ) |
( !(l5) && !(b) && _ && l4 && m1 ) ;
return
(_ && b && m0 && !(l4) && !(m1)) |
(l5 && b && _ && l4 && m1) |
(!(l5) && !(b) && !(m0) && _ && _) |
(_ && !(b) && !(m0) && !(l4) && !(m1)) |
(l5 && b && !(m0) && l4 && _) |
(l5 && !(b) && m0 && l4 && !(m1)) |
(!(l5) && b && m0 && _ && !(m1)) |
(!(l5) && _ && !(m0) && !(l4) && m1) |
(l5 && _ && m0 && !(l4) && m1) |
(!(l5) && !(b) && _ && l4 && m1) ;
}
static bool espresso_implementation_g3(bool c, bool r1, bool r3, bool m3, bool m5) {
// output_g3 = (c&r1&!m3&!r3) | (m5&c&m3&r3) | (!m5&!c&!r1) | (!c&!r1&!m3&!r3) | (!m5&!r1&m3&!r3) | (m5&r1&m3&!r3) | (m5&c&!r1&r3) | (m5&!c&r1&!m3&r3) | (!m5&c&r1&!m3) | (!m5&!c&m3&r3);
static const bool _ = true;
return
( _ && c && r1 && !(m3) && !(r3) ) |
( m5 && c && _ && m3 && r3 ) |
( !(m5) && !(c) && !(r1) && _ && _ ) |
( _ && !(c) && !(r1) && !(m3) && !(r3) ) |
( !(m5) && _ && !(r1) && m3 && !(r3) ) |
( m5 && _ && r1 && m3 && !(r3) ) |
( m5 && c && !(r1) && _ && r3 ) |
( m5 && !(c) && r1 && !(m3) && r3 ) |
( !(m5) && c && r1 && !(m3) && _ ) |
( !(m5) && !(c) && _ && m3 && r3 ) ;
(_ && c && r1 && !(m3) && !(r3)) |
(m5 && c && _ && m3 && r3) |
(!(m5) && !(c) && !(r1) && _ && _) |
(_ && !(c) && !(r1) && !(m3) && !(r3)) |
(!(m5) && _ && !(r1) && m3 && !(r3)) |
(m5 && _ && r1 && m3 && !(r3)) |
(m5 && c && !(r1) && _ && r3) |
(m5 && !(c) && r1 && !(m3) && r3) |
(!(m5) && c && r1 && !(m3) && _) |
(!(m5) && !(c) && _ && m3 && r3) ;
}
static bool espresso_implementation_g4(bool r0, bool r2, bool r4, bool r5, bool r6) {
// output_g4 = (r2&r6&r0&!r5) | (r4&r6&!r0&r5) | (!r2&!r4&!r6) | (r2&r4&!r6&!r0&!r5) | (r2&!r4&r6&!r5) | (!r2&r4&r6&!r0) | (!r2&!r6&r0&!r5) | (!r4&!r6&!r0&r5) | (r2&r4&r0&r5) | (!r2&!r4&r0&r5);
static const bool _ = true;
return
( r2 && _ && r6 && r0 && !(r5) ) |
( _ && r4 && r6 && !(r0) && r5 ) |
( !(r2) && !(r4) && !(r6) && _ && _ ) |
( r2 && r4 && !(r6) && !(r0) && !(r5) ) |
( r2 && !(r4) && r6 && _ && !(r5) ) |
( !(r2) && r4 && r6 && !(r0) && _ ) |
( !(r2) && _ && !(r6) && r0 && !(r5) ) |
( _ && !(r4) && !(r6) && !(r0) && r5 ) |
( r2 && r4 && _ && r0 && r5 ) |
( !(r2) && !(r4) && _ && r0 && r5 ) ;
(r2 && _ && r6 && r0 && !(r5)) |
(_ && r4 && r6 && !(r0) && r5) |
(!(r2) && !(r4) && !(r6) && _ && _) |
(r2 && r4 && !(r6) && !(r0) && !(r5)) |
(r2 && !(r4) && r6 && _ && !(r5)) |
(!(r2) && r4 && r6 && !(r0) && _) |
(!(r2) && _ && !(r6) && r0 && !(r5)) |
(_ && !(r4) && !(r6) && !(r0) && r5) |
(r2 && r4 && _ && r0 && r5) |
(!(r2) && !(r4) && _ && r0 && r5) ;
}
static bool espresso_implementation_XX(bool l0, bool l4, bool l6, bool m1, bool m3, bool r0, bool r3, bool r5) {
// output_XX = (!l6&m1&!r0) | (l4&!m3&r3) | (!l4&l6&!r5) | (!l0&!m1&m3) | (!l0&r3&!r5);
static const bool _ = true;
return
( _ && _ && !(l6) && m1 && _ && !(r0) && _ && _ ) |
( _ && l4 && _ && _ && !(m3) && _ && r3 && _ ) |
( _ && !(l4) && l6 && _ && _ && _ && _ && !(r5) ) |
( !(l0) && _ && _ && !(m1) && m3 && _ && _ && _ ) |
( !(l0) && _ && _ && _ && _ && _ && r3 && !(r5) );
(_ && _ && !(l6) && m1 && _ && !(r0) && _ && _) |
(_ && l4 && _ && _ && !(m3) && _ && r3 && _) |
(_ && !(l4) && l6 && _ && _ && _ && _ && !(r5)) |
(!(l0) && _ && _ && !(m1) && m3 && _ && _ && _) |
(!(l0) && _ && _ && _ && _ && _ && r3 && !(r5));
}
static bool verify_alternatives(void)
{
static bool verify_alternatives(void) {
bool any_failures_overall = false;
for (uint16_t q = 0; q < ARRAY_SIZE2(verification_table); ++q) {
bool any_failures_this_table = false;
VERIFICATION_T const * vt = &verification_table[q];
const char* fstr = vt->output_name;
const char *fstr = vt->output_name;
uint16_t limit = 1u << vt->input_count;
for (uint16_t fn_idx = 0; fn_idx < vt->altFnCount; ++fn_idx ) {
for (uint16_t fn_idx = 0; fn_idx < vt->altFnCount; ++fn_idx) {
bool any_failures_this_table_alts = false;
const lookuptable_func_t fn = vt->altFns[fn_idx];
@@ -608,7 +607,7 @@ static bool verify_alternatives(void)
} else {
printf("SUCCESS ---------> All alternate for %s \n", fstr);
}
any_failures_overall |= any_failures_this_table;
}
@@ -620,9 +619,8 @@ static bool verify_alternatives(void)
return !any_failures_overall;
}
static bool verify_lut_g1(void)
{
static const char* fstr = "verify_lut_g1";
static bool verify_lut_g1(void) {
static const char *fstr = "verify_lut_g1";
bool any_failures = false;
for (uint8_t i = 0; i < 32; ++i) {
INDEX_G1 t = { .as_uint8_t = i };
@@ -640,13 +638,12 @@ static bool verify_lut_g1(void)
}
return !any_failures;
}
static bool verify_lut_g2(void)
{
static const char* fstr = "verify_lut_g2";
static bool verify_lut_g2(void) {
static const char *fstr = "verify_lut_g2";
bool any_failures = false;
for (uint8_t i = 0; i < 32; ++i) {
INDEX_G2 t = { .as_uint8_t = i };
bool lut_result = get_bit(small_lut_group2, i);
bool lut_result = get_bit(small_lut_group2, i);
bool other_result = espresso_implementation_g2(t.b, t.l4, t.l5, t.m0, t.m1);
if (lut_result != other_result) {
printf("%s: verification failed for index %d\n", fstr, t.as_uint8_t);
@@ -660,9 +657,8 @@ static bool verify_lut_g2(void)
}
return !any_failures;
}
static bool verify_lut_g3(void)
{
static const char* fstr = "verify_lut_g3";
static bool verify_lut_g3(void) {
static const char *fstr = "verify_lut_g3";
bool any_failures = false;
for (uint8_t i = 0; i < 32; ++i) {
INDEX_G3 t = { .as_uint8_t = i };
@@ -680,9 +676,8 @@ static bool verify_lut_g3(void)
}
return !any_failures;
}
static bool verify_lut_g4(void)
{
static const char* fstr = "verify_lut_g4";
static bool verify_lut_g4(void) {
static const char *fstr = "verify_lut_g4";
bool any_failures = false;
for (uint8_t i = 0; i < 32; ++i) {
INDEX_G4 t = { .as_uint8_t = i };
@@ -700,9 +695,8 @@ static bool verify_lut_g4(void)
}
return !any_failures;
}
static bool verify_lut_XX(void)
{
static const char* fstr = "verify_lut_XX";
static bool verify_lut_XX(void) {
static const char *fstr = "verify_lut_XX";
bool any_failures = false;
for (uint16_t ix = 0; ix < 256; ++ix) {
uint8_t i = (uint8_t)ix;
@@ -737,7 +731,7 @@ static bool generate_espresso_file(uint8_t input_count, const char * const * inp
const uint16_t iterations = 1u << input_count;
fprintf(f_output, ".ilb");
for (uint16_t i = 0; i < input_count; ++i) {
const char* name = input_names[i];
const char *name = input_names[i];
fprintf(f_output, " %s", name);
}
fprintf(f_output, "\n");
@@ -761,8 +755,7 @@ static bool generate_espresso_file(uint8_t input_count, const char * const * inp
return true;
}
bool generate_all_lut_espresso_files(void)
{
bool generate_all_lut_espresso_files(void) {
bool any_failures = false;
@@ -784,12 +777,12 @@ bool generate_all_lut_espresso_files(void)
}
if (file != NULL) {
current_result = generate_espresso_file(
args->input_count,
args->names,
args->output_name,
args->lut_start,
file
);
args->input_count,
args->names,
args->output_name,
args->lut_start,
file
);
if (!current_result) {
printf("Failed to generate espresso file for %s\n", args->output_name);
}
@@ -803,8 +796,7 @@ bool generate_all_lut_espresso_files(void)
return !any_failures;
}
bool verify_espresso_results(void)
{
bool verify_espresso_results(void) {
//generate_all_lut_espresso_files();
bool unused = verify_alternatives();
+69 -71
View File
@@ -45,27 +45,25 @@ SOFTWARE.
*/
#ifndef __has_feature
#define __has_feature(x) 0 /* Compatibility with non-clang compilers. */
#define __has_feature(x) 0 /* Compatibility with non-clang compilers. */
#endif
#if (defined(__cplusplus) && __cplusplus >= 201103L) || /* any compiler claiming C++11 support */ \
(defined(__cplusplus) && _MSC_VER >= 1900 && __cplusplus != 199711L) || /* Visual C++ 2015 or higher */ \
__has_feature(cxx_constexpr) /* CLang versions supporting constexp */
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using C++11 version" )
#endif
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using C++11 version" )
#endif
namespace detail
{
template <typename T, size_t N>
constexpr size_t ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(T const (&)[N]) noexcept
{
return N;
}
} /* namespace detail */
#define ARRAY_SIZE2(arr) detail::ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(arr)
namespace detail {
template <typename T, size_t N>
constexpr size_t ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(T const(&)[N]) noexcept {
return N;
}
} /* namespace detail */
#define ARRAY_SIZE2(arr) detail::ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(arr)
#elif defined(__cplusplus) && __cplusplus >= 199711L && ( /* C++ 98 trick */ \
defined(__INTEL_COMPILER) || \
@@ -75,81 +73,81 @@ SOFTWARE.
(__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
)))
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message "ARRAY_SIZE2 -- Using C++98 version"
#endif
template <typename T, size_t N>
char(&_ArraySizeHelperRequiresArray(T(&)[N]))[N];
#define ARRAY_SIZE2(x) sizeof(_ArraySizeHelperRequiresArray(x))
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message "ARRAY_SIZE2 -- Using C++98 version"
#endif
template <typename T, size_t N>
char(&_ArraySizeHelperRequiresArray(T(&)[N]))[N];
#define ARRAY_SIZE2(x) sizeof(_ArraySizeHelperRequiresArray(x))
#elif defined(__cplusplus) /* && ((__cplusplus >= 199711L) || defined(__INTEL_COMPILER) || defined(__clang__)) */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using Ivan J. Johnson's C++ version" )
#endif
/*
Works on older compilers, even Visual C++ 6....
Created by Ivan J. Johnson, March 06, 2007
See http://drdobbs.com/cpp/197800525?pgno=1
Full description is in markdown file array_size2.md
*/
#define ARRAY_SIZE2(arr) ( \
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using Ivan J. Johnson's C++ version" )
#endif
/*
Works on older compilers, even Visual C++ 6....
Created by Ivan J. Johnson, March 06, 2007
See http://drdobbs.com/cpp/197800525?pgno=1
Full description is in markdown file array_size2.md
*/
#define ARRAY_SIZE2(arr) ( \
0 * sizeof(reinterpret_cast<const ::Bad_arg_to_ARRAY_SIZE2*>(arr)) + /*check1*/ \
0 * sizeof(::Bad_arg_to_ARRAY_SIZE2::check_type((arr), &(arr))) + /*check2*/ \
sizeof(arr) / sizeof((arr)[0]) /* eval */ \
)
struct Bad_arg_to_ARRAY_SIZE2 {
class Is_pointer; /* incomplete */
class Is_array {};
template <typename T>
static Is_pointer check_type(T const *, T const * const *);
static Is_array check_type(void const *, void const *);
};
struct Bad_arg_to_ARRAY_SIZE2 {
class Is_pointer; /* incomplete */
class Is_array {};
template <typename T>
static Is_pointer check_type(T const *, T const * const *);
static Is_array check_type(void const *, void const *);
};
#elif !defined(__cplusplus) && defined(__GNUC__)
#include <stdint.h>
#include <stdint.h>
/**
Even C can have type-safety for equivalent of ARRAY_SIZE() macro,
when using the following two GCC extensions:
typeof()
__builtin_types_compatible_p()
*/
/**
Even C can have type-safety for equivalent of ARRAY_SIZE() macro,
when using the following two GCC extensions:
typeof()
__builtin_types_compatible_p()
*/
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using GNUC version" )
#endif
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using GNUC version" )
#endif
/**
validated using:
MSP430 gcc 4.5.3
x86-64 icc 16.0.3
x86-64 gcc 4.1.2
x86-64 clang 3.0.0
AVR gcc 4.5.4
ARM gcc 4.5.4
*/
/**
validated using:
MSP430 gcc 4.5.3
x86-64 icc 16.0.3
x86-64 gcc 4.1.2
x86-64 clang 3.0.0
AVR gcc 4.5.4
ARM gcc 4.5.4
*/
#define __SIMPLEHACKS_COMPATIBLE_TYPES__(a,b) __builtin_types_compatible_p(__typeof__(a), __typeof__(b)) /* GCC extensions */
#define __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(x) (sizeof(struct { uint8_t q: (-!!(x)*0x1ee7)+1u;})-1u) /* if x is zero, reports "error: negative width in bit-field '<anonymous>'" */
#define __SIMPLEHACKS_MUST_BE_ARRAY__(x) __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(__SIMPLEHACKS_COMPATIBLE_TYPES__((x), &(*x)))
#define ARRAY_SIZE2(_arr) ( (sizeof(_arr) / sizeof((_arr)[0])) + __SIMPLEHACKS_MUST_BE_ARRAY__(_arr) ) /* compile-time error if not an array */
#define __SIMPLEHACKS_COMPATIBLE_TYPES__(a,b) __builtin_types_compatible_p(__typeof__(a), __typeof__(b)) /* GCC extensions */
#define __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(x) (sizeof(struct { uint8_t q: (-!!(x)*0x1ee7)+1u;})-1u) /* if x is zero, reports "error: negative width in bit-field '<anonymous>'" */
#define __SIMPLEHACKS_MUST_BE_ARRAY__(x) __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(__SIMPLEHACKS_COMPATIBLE_TYPES__((x), &(*x)))
#define ARRAY_SIZE2(_arr) ( (sizeof(_arr) / sizeof((_arr)[0])) + __SIMPLEHACKS_MUST_BE_ARRAY__(_arr) ) /* compile-time error if not an array */
#else
/**
The good news is that all compilers (as of 20202-05-08)
on godbolt.org are fully supported. Therefore, if some
other compiler does not support any of the above method,
it's important to force a compile-time error, to avoid
any suggestion that this provides a safe macro.
*/
#error "Unable to provide type-safe ARRAY_SIZE2 macro"
/**
The good news is that all compilers (as of 20202-05-08)
on godbolt.org are fully supported. Therefore, if some
other compiler does not support any of the above method,
it's important to force a compile-time error, to avoid
any suggestion that this provides a safe macro.
*/
#error "Unable to provide type-safe ARRAY_SIZE2 macro"
#endif
+69 -71
View File
@@ -45,27 +45,25 @@ SOFTWARE.
*/
#ifndef __has_feature
#define __has_feature(x) 0 /* Compatibility with non-clang compilers. */
#define __has_feature(x) 0 /* Compatibility with non-clang compilers. */
#endif
#if (defined(__cplusplus) && __cplusplus >= 201103L) || /* any compiler claiming C++11 support */ \
(defined(__cplusplus) && _MSC_VER >= 1900 && __cplusplus != 199711L) || /* Visual C++ 2015 or higher */ \
__has_feature(cxx_constexpr) /* CLang versions supporting constexp */
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using C++11 version" )
#endif
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using C++11 version" )
#endif
namespace detail
{
template <typename T, size_t N>
constexpr size_t ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(T const (&)[N]) noexcept
{
return N;
}
} /* namespace detail */
#define ARRAY_SIZE2(arr) detail::ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(arr)
namespace detail {
template <typename T, size_t N>
constexpr size_t ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(T const(&)[N]) noexcept {
return N;
}
} /* namespace detail */
#define ARRAY_SIZE2(arr) detail::ARRAY_SIZE2_ARGUMENT_CANNOT_BE_POINTER(arr)
#elif defined(__cplusplus) && __cplusplus >= 199711L && ( /* C++ 98 trick */ \
defined(__INTEL_COMPILER) || \
@@ -75,81 +73,81 @@ SOFTWARE.
(__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
)))
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message "ARRAY_SIZE2 -- Using C++98 version"
#endif
template <typename T, size_t N>
char(&_ArraySizeHelperRequiresArray(T(&)[N]))[N];
#define ARRAY_SIZE2(x) sizeof(_ArraySizeHelperRequiresArray(x))
#include <stddef.h> /* required for size_t */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message "ARRAY_SIZE2 -- Using C++98 version"
#endif
template <typename T, size_t N>
char(&_ArraySizeHelperRequiresArray(T(&)[N]))[N];
#define ARRAY_SIZE2(x) sizeof(_ArraySizeHelperRequiresArray(x))
#elif defined(__cplusplus) /* && ((__cplusplus >= 199711L) || defined(__INTEL_COMPILER) || defined(__clang__)) */
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using Ivan J. Johnson's C++ version" )
#endif
/*
Works on older compilers, even Visual C++ 6....
Created by Ivan J. Johnson, March 06, 2007
See http://drdobbs.com/cpp/197800525?pgno=1
Full description is in markdown file array_size2.md
*/
#define ARRAY_SIZE2(arr) ( \
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using Ivan J. Johnson's C++ version" )
#endif
/*
Works on older compilers, even Visual C++ 6....
Created by Ivan J. Johnson, March 06, 2007
See http://drdobbs.com/cpp/197800525?pgno=1
Full description is in markdown file array_size2.md
*/
#define ARRAY_SIZE2(arr) ( \
0 * sizeof(reinterpret_cast<const ::Bad_arg_to_ARRAY_SIZE2*>(arr)) + /*check1*/ \
0 * sizeof(::Bad_arg_to_ARRAY_SIZE2::check_type((arr), &(arr))) + /*check2*/ \
sizeof(arr) / sizeof((arr)[0]) /* eval */ \
)
struct Bad_arg_to_ARRAY_SIZE2 {
class Is_pointer; /* incomplete */
class Is_array {};
template <typename T>
static Is_pointer check_type(T const *, T const * const *);
static Is_array check_type(void const *, void const *);
};
struct Bad_arg_to_ARRAY_SIZE2 {
class Is_pointer; /* incomplete */
class Is_array {};
template <typename T>
static Is_pointer check_type(T const *, T const * const *);
static Is_array check_type(void const *, void const *);
};
#elif !defined(__cplusplus) && defined(__GNUC__)
#include <stdint.h>
#include <stdint.h>
/**
Even C can have type-safety for equivalent of ARRAY_SIZE() macro,
when using the following two GCC extensions:
typeof()
__builtin_types_compatible_p()
*/
/**
Even C can have type-safety for equivalent of ARRAY_SIZE() macro,
when using the following two GCC extensions:
typeof()
__builtin_types_compatible_p()
*/
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using GNUC version" )
#endif
#if defined(ARRAYSIZE2_SHOW_VERSION_MESSAGE)
#pragma message( "ARRAY_SIZE2 -- Using GNUC version" )
#endif
/**
validated using:
MSP430 gcc 4.5.3
x86-64 icc 16.0.3
x86-64 gcc 4.1.2
x86-64 clang 3.0.0
AVR gcc 4.5.4
ARM gcc 4.5.4
*/
/**
validated using:
MSP430 gcc 4.5.3
x86-64 icc 16.0.3
x86-64 gcc 4.1.2
x86-64 clang 3.0.0
AVR gcc 4.5.4
ARM gcc 4.5.4
*/
#define __SIMPLEHACKS_COMPATIBLE_TYPES__(a,b) __builtin_types_compatible_p(__typeof__(a), __typeof__(b)) /* GCC extensions */
#define __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(x) (sizeof(struct { uint8_t q: (-!!(x)*0x1ee7)+1u;})-1u) /* if x is zero, reports "error: negative width in bit-field '<anonymous>'" */
#define __SIMPLEHACKS_MUST_BE_ARRAY__(x) __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(__SIMPLEHACKS_COMPATIBLE_TYPES__((x), &(*x)))
#define ARRAY_SIZE2(_arr) ( (sizeof(_arr) / sizeof((_arr)[0])) + __SIMPLEHACKS_MUST_BE_ARRAY__(_arr) ) /* compile-time error if not an array */
#define __SIMPLEHACKS_COMPATIBLE_TYPES__(a,b) __builtin_types_compatible_p(__typeof__(a), __typeof__(b)) /* GCC extensions */
#define __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(x) (sizeof(struct { uint8_t q: (-!!(x)*0x1ee7)+1u;})-1u) /* if x is zero, reports "error: negative width in bit-field '<anonymous>'" */
#define __SIMPLEHACKS_MUST_BE_ARRAY__(x) __SIMPLEHACKS_BUILD_ERROR_ON_NONZERO__(__SIMPLEHACKS_COMPATIBLE_TYPES__((x), &(*x)))
#define ARRAY_SIZE2(_arr) ( (sizeof(_arr) / sizeof((_arr)[0])) + __SIMPLEHACKS_MUST_BE_ARRAY__(_arr) ) /* compile-time error if not an array */
#else
/**
The good news is that all compilers (as of 20202-05-08)
on godbolt.org are fully supported. Therefore, if some
other compiler does not support any of the above method,
it's important to force a compile-time error, to avoid
any suggestion that this provides a safe macro.
*/
#error "Unable to provide type-safe ARRAY_SIZE2 macro"
/**
The good news is that all compilers (as of 20202-05-08)
on godbolt.org are fully supported. Therefore, if some
other compiler does not support any of the above method,
it's important to force a compile-time error, to avoid
any suggestion that this provides a safe macro.
*/
#error "Unable to provide type-safe ARRAY_SIZE2 macro"
#endif
+55 -55
View File
@@ -56,36 +56,36 @@ static const TEST_VECTOR_T test_vectors[] = {
};
// Comment
/// <summary>
/// Initializes to allow iterative recovery
/// of multiple potential keys. After calling
/// this init() function, can repeatedly call
/// the next() function until it returns false
/// to obtain all potential keys.
/// </summary>
/// <param name="input_partial_key">
/// Top 48 bits of the key, such as those discovered
/// using the proxmark3 command `lf em 4x70 brute`.
/// Only k[0..5] are used from this parameter,
/// corresponding to K₉₅..K₄₈.
/// </param>
/// <param name="input_nonce">
/// The nonce value.
/// Typically from a sniffed authentication.
/// </param>
/// <param name="input_frn">
/// The challenge sent from the reader (e.g., car)
/// to the tag (e.g., key).
/// Typically from a sniffed authentication.
/// </param>
/// <param name="input_grn">
/// The response sent from the tag (e.g., key)
/// to the car (e.g., car).
/// Typically from a sniffed authentication.
/// </param>
/// <remarks>
/// Note: In C++, each parameter would be a reference (not pointer).
/// </remarks>
/// <summary>
/// Initializes to allow iterative recovery
/// of multiple potential keys. After calling
/// this init() function, can repeatedly call
/// the next() function until it returns false
/// to obtain all potential keys.
/// </summary>
/// <param name="input_partial_key">
/// Top 48 bits of the key, such as those discovered
/// using the proxmark3 command `lf em 4x70 brute`.
/// Only k[0..5] are used from this parameter,
/// corresponding to K₉₅..K₄₈.
/// </param>
/// <param name="input_nonce">
/// The nonce value.
/// Typically from a sniffed authentication.
/// </param>
/// <param name="input_frn">
/// The challenge sent from the reader (e.g., car)
/// to the tag (e.g., key).
/// Typically from a sniffed authentication.
/// </param>
/// <param name="input_grn">
/// The response sent from the tag (e.g., key)
/// to the car (e.g., car).
/// Typically from a sniffed authentication.
/// </param>
/// <remarks>
/// Note: In C++, each parameter would be a reference (not pointer).
/// </remarks>
// void id48lib_key_recovery_init(
// const ID48LIB_KEY *input_partial_key,
@@ -95,30 +95,30 @@ static const TEST_VECTOR_T test_vectors[] = {
// );
// Comment
/// <summary>
/// This can be repeated called (after calling init())
/// to find the next potential key for the given
/// partial key + nonce + frn + grn values.
/// I've seen combinations that have up to six
/// potential keys available, although typically
/// there are 1-3 results.
/// Each call to this function will return a single
/// value. Call repeatedly until the function returns
/// false to get all potential keys.
/// </summary>
/// <param name="potential_key_output">
/// When the function returns true, this caller-provided
/// value will be filled with the 96-bit key that, when
/// programmed to the tag, should authenticate against
/// the nonce+frn values, with tag returning the grn value.
/// </param>
/// <returns>
/// true when another potential key has been found.
/// false if no additional potential keys have been found.
/// </returns>
/// <remarks>
/// Note: In C++, each parameter would be a reference (not pointer).
/// </remarks>
/// <summary>
/// This can be repeated called (after calling init())
/// to find the next potential key for the given
/// partial key + nonce + frn + grn values.
/// I've seen combinations that have up to six
/// potential keys available, although typically
/// there are 1-3 results.
/// Each call to this function will return a single
/// value. Call repeatedly until the function returns
/// false to get all potential keys.
/// </summary>
/// <param name="potential_key_output">
/// When the function returns true, this caller-provided
/// value will be filled with the 96-bit key that, when
/// programmed to the tag, should authenticate against
/// the nonce+frn values, with tag returning the grn value.
/// </param>
/// <returns>
/// true when another potential key has been found.
/// false if no additional potential keys have been found.
/// </returns>
/// <remarks>
/// Note: In C++, each parameter would be a reference (not pointer).
/// </remarks>
// bool id48lib_key_recovery_next(
// ID48LIB_KEY *potential_key_output
// );
@@ -144,7 +144,7 @@ bool recovery_succeeds(const TEST_VECTOR_T *test_vector, bool zero_partial_key)
// just verify that the potential key matches the test vector
if (bytes_equal(potential_key.k, test_vector->key.k, sizeof(test_vector->key.k))) {
key_found = true;
}
}
}
return key_found;
}
+6 -6
View File
@@ -73,10 +73,10 @@ main(int argc, char *argv[]) {
setbmp();
if (BMP_BIT != bmpbit || BMP_SUB != bmpsub) {
fprintf(stderr, "reveng: configuration fault. Update "
"reveng/config.h with these definitions and "
"recompile:\n"
"\t#define BMP_BIT %d\n"
"\t#define BMP_SUB %d\n",
"reveng/config.h with these definitions and "
"recompile:\n"
"\t#define BMP_BIT %d\n"
"\t#define BMP_SUB %d\n",
bmpbit, bmpsub);
exit(EXIT_FAILURE);
}
@@ -84,8 +84,8 @@ main(int argc, char *argv[]) {
/* check the bitmap constant macro */
if (~(bmp_t) 0 != ~BMP_C(0)) {
fprintf(stderr, "reveng: configuration fault. Edit "
"the definition of BMP_C() in config.h to "
"match BMP_T and recompile.\n");
"the definition of BMP_C() in config.h to "
"match BMP_T and recompile.\n");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
+229 -229
View File
@@ -137,19 +137,19 @@ static const bmp_t b40c[] = {
# else /* BMP_BIT */
static const bmp_t b40[] = {
BMP_C(0x00048200) << (BMP_BIT - 32) | BMP_C(0x04) >> (39 - BMP_BIT),
BMP_C(0x09) << (BMP_BIT * 2 - 40),
BMP_C(0x09) << (BMP_BIT * 2 - 40),
};
static const bmp_t b40a[] = {
BMP_C(0xffffffff) << (BMP_BIT - 32) | BMP_C(0x7f) >> (39 - BMP_BIT),
BMP_C(0xff) << (BMP_BIT * 2 - 40),
BMP_C(0xff) << (BMP_BIT * 2 - 40),
};
static const bmp_t b40b[] = {
BMP_C(0xd4164fc6) << (BMP_BIT - 32) | BMP_C(0x23) >> (39 - BMP_BIT),
BMP_C(0x46) << (BMP_BIT * 2 - 40),
BMP_C(0x46) << (BMP_BIT * 2 - 40),
};
static const bmp_t b40c[] = {
BMP_C(0xc4ff8071) << (BMP_BIT - 32) | BMP_C(0x7f) >> (39 - BMP_BIT),
BMP_C(0xff) << (BMP_BIT * 2 - 40),
BMP_C(0xff) << (BMP_BIT * 2 - 40),
};
# endif /* BMP_BIT */
@@ -187,43 +187,43 @@ static const bmp_t b64i[] = {
# else /* BMP_BIT */
static const bmp_t b64[] = {
BMP_C(0x00000000) << (BMP_BIT - 32) | BMP_C(0x0000000d) >> (63 - BMP_BIT),
BMP_C(0x0000001b) << (BMP_BIT * 2 - 64),
BMP_C(0x0000001b) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64a[] = {
BMP_C(0xffffffff) << (BMP_BIT - 32) | BMP_C(0x7fffffff) >> (63 - BMP_BIT),
BMP_C(0xffffffff) << (BMP_BIT * 2 - 64),
BMP_C(0xffffffff) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64b[] = {
BMP_C(0xb90956c7) << (BMP_BIT - 32) | BMP_C(0x3ad20800) >> (63 - BMP_BIT),
BMP_C(0x75a41001) << (BMP_BIT * 2 - 64),
BMP_C(0x75a41001) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64c[] = {
BMP_C(0x53000000) << (BMP_BIT - 32) | BMP_C(0x00000000) >> (63 - BMP_BIT),
BMP_C(0x00000000) << (BMP_BIT * 2 - 64),
BMP_C(0x00000000) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64d[] = {
BMP_C(0x42f0e1eb) << (BMP_BIT - 32) | BMP_C(0x54f51b49) >> (63 - BMP_BIT),
BMP_C(0xa9ea3693) << (BMP_BIT * 2 - 64),
BMP_C(0xa9ea3693) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64e[] = {
BMP_C(0x6c40df5f) << (BMP_BIT - 32) | BMP_C(0x05a4b9a3) >> (63 - BMP_BIT),
BMP_C(0x0b497347) << (BMP_BIT * 2 - 64),
BMP_C(0x0b497347) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64f[] = {
BMP_C(0x62ec59e3) << (BMP_BIT - 32) | BMP_C(0x78d27805) >> (63 - BMP_BIT),
BMP_C(0xf1a4f00a) << (BMP_BIT * 2 - 64),
BMP_C(0xf1a4f00a) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64g[] = {
BMP_C(0xfcacbebd) << (BMP_BIT - 32) | BMP_C(0x2c98d4c9) >> (63 - BMP_BIT),
BMP_C(0x5931a992) << (BMP_BIT * 2 - 64),
BMP_C(0x5931a992) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64h[] = {
BMP_C(0x995dc9bb) << (BMP_BIT - 32) | BMP_C(0x6f8c9cfd) >> (63 - BMP_BIT),
BMP_C(0xdf1939fa) << (BMP_BIT * 2 - 64),
BMP_C(0xdf1939fa) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64i[] = {
BMP_C(0x49958c9a) << (BMP_BIT - 32) | BMP_C(0x5ebe9a9f) >> (63 - BMP_BIT),
BMP_C(0xbd7d353f) << (BMP_BIT * 2 - 64),
BMP_C(0xbd7d353f) << (BMP_BIT * 2 - 64),
};
# endif /* BMP_BIT */
@@ -237,22 +237,22 @@ static const bmp_t b82a[] = {
# elif BMP_BIT >= 41
static const bmp_t b82[] = {
BMP_C(0x01846008880) << (BMP_BIT - 41) | BMP_C(0x08a00a20208) >> (81 - BMP_BIT),
BMP_C(0x11401440411) << (BMP_BIT * 2 - 82),
BMP_C(0x11401440411) << (BMP_BIT * 2 - 82),
};
static const bmp_t b82a[] = {
BMP_C(0x04f541fb128) << (BMP_BIT - 41) | BMP_C(0x011c00feb09) >> (81 - BMP_BIT),
BMP_C(0x023801fd612) << (BMP_BIT * 2 - 82),
BMP_C(0x023801fd612) << (BMP_BIT * 2 - 82),
};
# else /* BMP_BIT */
static const bmp_t b82[] = {
BMP_C(0x0c230044) << (BMP_BIT - 32) | BMP_C(0x040) >> (40 - BMP_BIT),
BMP_C(0x40450051) << (BMP_BIT * 2 - 64) | BMP_C(0x00104) >> (80 - BMP_BIT * 2),
BMP_C(0x00411) << (BMP_BIT * 3 - 82),
BMP_C(0x40450051) << (BMP_BIT * 2 - 64) | BMP_C(0x00104) >> (80 - BMP_BIT * 2),
BMP_C(0x00411) << (BMP_BIT * 3 - 82),
};
static const bmp_t b82a[] = {
BMP_C(0x27aa0fd8) << (BMP_BIT - 32) | BMP_C(0x094) >> (40 - BMP_BIT),
BMP_C(0x9408e007) << (BMP_BIT * 2 - 64) | BMP_C(0x0f584) >> (80 - BMP_BIT * 2),
BMP_C(0x3d612) << (BMP_BIT * 3 - 82),
BMP_C(0x9408e007) << (BMP_BIT * 2 - 64) | BMP_C(0x0f584) >> (80 - BMP_BIT * 2),
BMP_C(0x3d612) << (BMP_BIT * 3 - 82),
};
# endif /* BMP_BIT */
@@ -262,215 +262,215 @@ static const bmp_t b82a[] = {
/* Array of the polynomial bitmaps used in the model table. */
static const bmp_t b32[] = {
BMP_C(0x000000af) << (BMP_BIT - 32), /* 0 -- 32,000000af */
BMP_C(0x00010000) << (BMP_BIT - 32), /* 1 -- 16, 0001 */
BMP_C(0x00020000) << (BMP_BIT - 32), /* 2 -- 15, 0001 */
BMP_C(0x00065b00) << (BMP_BIT - 32), /* 3 -- 24, 00065b */
BMP_C(0x007e0000) << (BMP_BIT - 32), /* 4 -- 16, 007e */
BMP_C(0x007f0000) << (BMP_BIT - 32), /* 5 -- 16, 007f */
BMP_C(0x03400000) << (BMP_BIT - 32), /* 6 -- 11, 01a */
BMP_C(0x0376e6e7) << (BMP_BIT - 32), /* 7 -- 32,0376e6e7 */
BMP_C(0x04c11db7) << (BMP_BIT - 32), /* 8 -- 32,04c11db7 */
BMP_C(0x05890000) << (BMP_BIT - 32), /* 9 -- 16, 0589 */
BMP_C(0x07000000) << (BMP_BIT - 32), /* 10 -- 8, 07 */
BMP_C(0x080b0000) << (BMP_BIT - 32), /* 11 -- 16, 080b */
BMP_C(0x09823b6e) << (BMP_BIT - 32), /* 12 -- 31,04c11db7 */
BMP_C(0x0b3c0000) << (BMP_BIT - 32), /* 13 -- 15, 059e */
BMP_C(0x0c000000) << (BMP_BIT - 32), /* 14 -- 6, 03 */
BMP_C(0x0c200000) << (BMP_BIT - 32), /* 15 -- 11, 061 */
BMP_C(0x0c780000) << (BMP_BIT - 32), /* 16 -- 14, 031e */
BMP_C(0x0fb30000) << (BMP_BIT - 32), /* 17 -- 16, 0fb3 */
BMP_C(0x10210000) << (BMP_BIT - 32), /* 18 -- 16, 1021 */
BMP_C(0x12000000) << (BMP_BIT - 32), /* 19 -- 7, 09 */
BMP_C(0x130d2afc) << (BMP_BIT - 32), /* 20 -- 30,04c34abf */
BMP_C(0x144e6300) << (BMP_BIT - 32), /* 21 -- 24, 144e63 */
BMP_C(0x15000000) << (BMP_BIT - 32), /* 22 -- 8, 15 */
BMP_C(0x1697d06a) << (BMP_BIT - 32), /* 23 -- 32,1697d06a */
BMP_C(0x17800000) << (BMP_BIT - 32), /* 24 -- 12, 178 */
BMP_C(0x18000000) << (BMP_BIT - 32), /* 25 -- 6, 06 */
BMP_C(0x19d3c8d8) << (BMP_BIT - 32), /* 26 -- 31,0ce9e46c */
BMP_C(0x1c000000) << (BMP_BIT - 32), /* 27 -- 6, 07 */
BMP_C(0x1d000000) << (BMP_BIT - 32), /* 28 -- 8, 1d */
BMP_C(0x1d0f0000) << (BMP_BIT - 32), /* 29 -- 16, 1d0f */
BMP_C(0x1dcf0000) << (BMP_BIT - 32), /* 30 -- 16, 1dcf */
BMP_C(0x1edc6f41) << (BMP_BIT - 32), /* 31 -- 32,1edc6f41 */
BMP_C(0x1f23b800) << (BMP_BIT - 32), /* 32 -- 24, 1f23b8 */
BMP_C(0x20000000) << (BMP_BIT - 32), /* 33 -- 4, 2 */
BMP_C(0x200fa500) << (BMP_BIT - 32), /* 34 -- 24, 200fa5 */
BMP_C(0x20140000) << (BMP_BIT - 32), /* 35 -- 14, 0805 */
BMP_C(0x20b40000) << (BMP_BIT - 32), /* 36 -- 14, 082d */
BMP_C(0x20fe0000) << (BMP_BIT - 32), /* 37 -- 16, 20fe */
BMP_C(0x21890000) << (BMP_BIT - 32), /* 38 -- 16, 2189 */
BMP_C(0x21cf0200) << (BMP_BIT - 32), /* 39 -- 24, 21cf02 */
BMP_C(0x23ef5200) << (BMP_BIT - 32), /* 40 -- 24, 23ef52 */
BMP_C(0x25000000) << (BMP_BIT - 32), /* 41 -- 8, 25 */
BMP_C(0x26000000) << (BMP_BIT - 32), /* 42 -- 8, 26 */
BMP_C(0x26b10000) << (BMP_BIT - 32), /* 43 -- 16, 26b1 */
BMP_C(0x27818000) << (BMP_BIT - 32), /* 44 -- 17, 04f03 */
BMP_C(0x27d00000) << (BMP_BIT - 32), /* 45 -- 13, 04fa */
BMP_C(0x28000000) << (BMP_BIT - 32), /* 46 -- 5, 05 */
BMP_C(0x29b10000) << (BMP_BIT - 32), /* 47 -- 16, 29b1 */
BMP_C(0x2f000000) << (BMP_BIT - 32), /* 48 -- 8, 2f */
BMP_C(0x30000000) << (BMP_BIT - 32), /* 49 -- 4, 3/ 5, 6 */
BMP_C(0x3010bf7f) << (BMP_BIT - 32), /* 50 -- 32,3010bf7f */
BMP_C(0x31000000) << (BMP_BIT - 32), /* 51 -- 8, 31 */
BMP_C(0x31800000) << (BMP_BIT - 32), /* 52 -- 10, 0c6 */
BMP_C(0x31c30000) << (BMP_BIT - 32), /* 53 -- 16, 31c3 */
BMP_C(0x328b6300) << (BMP_BIT - 32), /* 54 -- 24, 328b63 */
BMP_C(0x34000000) << (BMP_BIT - 32), /* 55 -- 6, 0d */
BMP_C(0x340bc6d9) << (BMP_BIT - 32), /* 56 -- 32,340bc6d9 */
BMP_C(0x37000000) << (BMP_BIT - 32), /* 57 -- 8, 37 */
BMP_C(0x38000000) << (BMP_BIT - 32), /* 58 -- 5, 07 */
BMP_C(0x39000000) << (BMP_BIT - 32), /* 59 -- 8, 39 */
BMP_C(0x3d650000) << (BMP_BIT - 32), /* 60 -- 16, 3d65 */
BMP_C(0x3e000000) << (BMP_BIT - 32), /* 61 -- 8, 3e */
BMP_C(0x40000000) << (BMP_BIT - 32), /* 62 -- 3, 2 */
BMP_C(0x42000000) << (BMP_BIT - 32), /* 63 -- 8, 42 */
BMP_C(0x44c20000) << (BMP_BIT - 32), /* 64 -- 16, 44c2 */
BMP_C(0x45270551) << (BMP_BIT - 32), /* 65 -- 32,45270551 */
BMP_C(0x48000000) << (BMP_BIT - 32), /* 66 -- 5, 09 */
BMP_C(0x49000000) << (BMP_BIT - 32), /* 67 -- 8, 49 */
BMP_C(0x4a800000) << (BMP_BIT - 32), /* 68 -- 10, 12a */
BMP_C(0x4acc0000) << (BMP_BIT - 32), /* 69 -- 15, 2566 */
BMP_C(0x4b000000) << (BMP_BIT - 32), /* 70 -- 8, 4b */
BMP_C(0x4b370000) << (BMP_BIT - 32), /* 71 -- 16, 4b37 */
BMP_C(0x4c000000) << (BMP_BIT - 32), /* 72 -- 6, 13 */
BMP_C(0x4c060000) << (BMP_BIT - 32), /* 73 -- 16, 4c06 */
BMP_C(0x53000000) << (BMP_BIT - 32), /* 74 -- 8, 53 */
BMP_C(0x55000000) << (BMP_BIT - 32), /* 75 -- 8, 55 */
BMP_C(0x55555500) << (BMP_BIT - 32), /* 76 -- 24, 555555 */
BMP_C(0x59350000) << (BMP_BIT - 32), /* 77 -- 16, 5935 */
BMP_C(0x5d380000) << (BMP_BIT - 32), /* 78 -- 16, 5d38 */
BMP_C(0x5d400000) << (BMP_BIT - 32), /* 79 -- 10, 175 */
BMP_C(0x5d6dcb00) << (BMP_BIT - 32), /* 80 -- 24, 5d6dcb */
BMP_C(0x60000000) << (BMP_BIT - 32), /* 81 -- 3, 3 */
BMP_C(0x60e00000) << (BMP_BIT - 32), /* 82 -- 11, 307 */
BMP_C(0x63d00000) << (BMP_BIT - 32), /* 83 -- 16, 63d0 */
BMP_C(0x64000000) << (BMP_BIT - 32), /* 84 -- 6, 19 */
BMP_C(0x66400000) << (BMP_BIT - 32), /* 85 -- 10, 199 */
BMP_C(0x66c50000) << (BMP_BIT - 32), /* 86 -- 16, 66c5 */
BMP_C(0x6f630000) << (BMP_BIT - 32), /* 87 -- 16, 6f63 */
BMP_C(0x6f910000) << (BMP_BIT - 32), /* 88 -- 16, 6f91 */
BMP_C(0x70000000) << (BMP_BIT - 32), /* 89 -- 4, 7 */
BMP_C(0x70a00000) << (BMP_BIT - 32), /* 90 -- 11, 385 */
BMP_C(0x755b0000) << (BMP_BIT - 32), /* 91 -- 16, 755b */
BMP_C(0x765e7680) << (BMP_BIT - 32), /* 92 -- 32,765e7680 */
BMP_C(0x76c20800) << (BMP_BIT - 32), /* 93 -- 32, 0ed841 */
BMP_C(0x7979bd00) << (BMP_BIT - 32), /* 94 -- 24, 7979bd */
BMP_C(0x7e000000) << (BMP_BIT - 32), /* 95 -- 8, 7e */
BMP_C(0x80000000) << (BMP_BIT - 32), /* 96 -- 3, 4 */
BMP_C(0x80006300) << (BMP_BIT - 32), /* 97 -- 24, 800063 */
BMP_C(0x80050000) << (BMP_BIT - 32), /* 98 -- 16, 8005 */
BMP_C(0x800d0000) << (BMP_BIT - 32), /* 99 -- 16, 800d */
BMP_C(0x800fe300) << (BMP_BIT - 32), /* 100 -- 24, 800fe3 */
BMP_C(0x80b40000) << (BMP_BIT - 32), /* 101 -- 14, 202d */
BMP_C(0x80c2e71c) << (BMP_BIT - 32), /* 102 -- 30,2030b9c7 */
BMP_C(0x80f00000) << (BMP_BIT - 32), /* 103 -- 12, 80f */
BMP_C(0x814141ab) << (BMP_BIT - 32), /* 104 -- 32,814141ab */
BMP_C(0x8144c800) << (BMP_BIT - 32), /* 105 -- 21, 102899 */
BMP_C(0x864cfb00) << (BMP_BIT - 32), /* 106 -- 24, 864cfb */
BMP_C(0x87315576) << (BMP_BIT - 32), /* 107 -- 32,87315576 */
BMP_C(0x89ec0000) << (BMP_BIT - 32), /* 108 -- 16, 89ec */
BMP_C(0x8a000000) << (BMP_BIT - 32), /* 109 -- 7, 45 */
BMP_C(0x8b320000) << (BMP_BIT - 32), /* 110 -- 15, 4599 */
BMP_C(0x8bb70000) << (BMP_BIT - 32), /* 111 -- 16, 8bb7 */
BMP_C(0x8cc00000) << (BMP_BIT - 32), /* 112 -- 10, 233 */
BMP_C(0x904cddbf) << (BMP_BIT - 32), /* 113 -- 32,904cddbf */
BMP_C(0x906e0000) << (BMP_BIT - 32), /* 114 -- 16, 906e */
BMP_C(0x94000000) << (BMP_BIT - 32), /* 115 -- 8, 94 */
BMP_C(0x97000000) << (BMP_BIT - 32), /* 116 -- 8, 97 */
BMP_C(0x98000000) << (BMP_BIT - 32), /* 117 -- 6, 26 */
BMP_C(0x99000000) << (BMP_BIT - 32), /* 118 -- 8, 99 */
BMP_C(0x9b000000) << (BMP_BIT - 32), /* 119 -- 8, 9b */
BMP_C(0x9c000000) << (BMP_BIT - 32), /* 120 -- 6, 27 */
BMP_C(0x9d5e4de2) << (BMP_BIT - 32), /* 121 -- 31,4eaf26f1 */
BMP_C(0x9e000000) << (BMP_BIT - 32), /* 122 -- 7, 4f */
BMP_C(0x9ecf0000) << (BMP_BIT - 32), /* 123 -- 16, 9ecf */
BMP_C(0xa0660000) << (BMP_BIT - 32), /* 124 -- 16, a066 */
BMP_C(0xa0970000) << (BMP_BIT - 32), /* 125 -- 16, a097 */
BMP_C(0xa1000000) << (BMP_BIT - 32), /* 126 -- 8, a1 */
BMP_C(0xa3660000) << (BMP_BIT - 32), /* 127 -- 16, a366 */
BMP_C(0xa6000000) << (BMP_BIT - 32), /* 128 -- 7, 53 */
BMP_C(0xa7000000) << (BMP_BIT - 32), /* 129 -- 8, a7 */
BMP_C(0xa8000000) << (BMP_BIT - 32), /* 130 -- 5, 15 */
BMP_C(0xa8190000) << (BMP_BIT - 32), /* 131 -- 16, a819 */
BMP_C(0xa833982b) << (BMP_BIT - 32), /* 132 -- 32,a833982b */
BMP_C(0xabcdef00) << (BMP_BIT - 32), /* 133 -- 24, abcdef */
BMP_C(0xac000000) << (BMP_BIT - 32), /* 134 -- 8, ac */
BMP_C(0xaee70000) << (BMP_BIT - 32), /* 135 -- 16, aee7 */
BMP_C(0xb0000000) << (BMP_BIT - 32), /* 136 -- 4, b */
BMP_C(0xb0010000) << (BMP_BIT - 32), /* 137 -- 16, b001 */
BMP_C(0xb2aa0000) << (BMP_BIT - 32), /* 138 -- 16, b2aa */
BMP_C(0xb3400000) << (BMP_BIT - 32), /* 139 -- 12, b34 */
BMP_C(0xb42d8000) << (BMP_BIT - 32), /* 140 -- 17, 1685b */
BMP_C(0xb4600000) << (BMP_BIT - 32), /* 141 -- 11, 5a3 */
BMP_C(0xb4c80000) << (BMP_BIT - 32), /* 142 -- 16, b4c8 */
BMP_C(0xb4f3e600) << (BMP_BIT - 32), /* 143 -- 24, b4f3e6 */
BMP_C(0xb704ce00) << (BMP_BIT - 32), /* 144 -- 24, b704ce */
BMP_C(0xb798b438) << (BMP_BIT - 32), /* 145 -- 32,b798b438 */
BMP_C(0xbb3d0000) << (BMP_BIT - 32), /* 146 -- 16, bb3d */
BMP_C(0xbc000000) << (BMP_BIT - 32), /* 147 -- 6,2f/ 8,bc */
BMP_C(0xbd0be338) << (BMP_BIT - 32), /* 148 -- 32,bd0be338 */
BMP_C(0xbdf40000) << (BMP_BIT - 32), /* 149 -- 16, bdf4 */
BMP_C(0xbf050000) << (BMP_BIT - 32), /* 150 -- 16, bf05 */
BMP_C(0xc0000000) << (BMP_BIT - 32), /* 151 -- 3, 6 */
BMP_C(0xc2000000) << (BMP_BIT - 32), /* 152 -- 7, 61 */
BMP_C(0xc25a5600) << (BMP_BIT - 32), /* 153 -- 24, c25a56 */
BMP_C(0xc2b70000) << (BMP_BIT - 32), /* 154 -- 16, c2b7 */
BMP_C(0xc2b80000) << (BMP_BIT - 32), /* 155 -- 14, 30ae */
BMP_C(0xc4000000) << (BMP_BIT - 32), /* 156 -- 8, c4 */
BMP_C(0xc6c60000) << (BMP_BIT - 32), /* 157 -- 16, c6c6 */
BMP_C(0xc7000000) << (BMP_BIT - 32), /* 158 -- 8, c7 */
BMP_C(0xc704dd7b) << (BMP_BIT - 32), /* 159 -- 32,c704dd7b */
BMP_C(0xc8000000) << (BMP_BIT - 32), /* 160 -- 5, 19 */
BMP_C(0xc8670000) << (BMP_BIT - 32), /* 161 -- 16, c867 */
BMP_C(0xcbf43926) << (BMP_BIT - 32), /* 162 -- 32,cbf43926 */
BMP_C(0xcde70300) << (BMP_BIT - 32), /* 163 -- 24, cde703 */
BMP_C(0xce3c0000) << (BMP_BIT - 32), /* 164 -- 16, ce3c */
BMP_C(0xd0000000) << (BMP_BIT - 32), /* 165 -- 8, d0 */
BMP_C(0xd02a0000) << (BMP_BIT - 32), /* 166 -- 15, 6815 */
BMP_C(0xd0db0000) << (BMP_BIT - 32), /* 167 -- 16, d0db */
BMP_C(0xd3100000) << (BMP_BIT - 32), /* 168 -- 12, d31 */
BMP_C(0xd3be9568) << (BMP_BIT - 32), /* 169 -- 30,34efa55a */
BMP_C(0xd4d00000) << (BMP_BIT - 32), /* 170 -- 12, d4d */
BMP_C(0xd5000000) << (BMP_BIT - 32), /* 171 -- 8, d5 */
BMP_C(0xd64e0000) << (BMP_BIT - 32), /* 172 -- 16, d64e */
BMP_C(0xda000000) << (BMP_BIT - 32), /* 173 -- 8, da */
BMP_C(0xdaf00000) << (BMP_BIT - 32), /* 174 -- 12, daf */
BMP_C(0xdebb20e3) << (BMP_BIT - 32), /* 175 -- 32,debb20e3 */
BMP_C(0xdf000000) << (BMP_BIT - 32), /* 176 -- 8, df */
BMP_C(0xe0000000) << (BMP_BIT - 32), /* 177 -- 3, 7 */
BMP_C(0xe3069283) << (BMP_BIT - 32), /* 178 -- 32,e3069283 */
BMP_C(0xe3940000) << (BMP_BIT - 32), /* 179 -- 16, e394 */
BMP_C(0xe5cc0000) << (BMP_BIT - 32), /* 180 -- 16, e5cc */
BMP_C(0xe7a80000) << (BMP_BIT - 32), /* 181 -- 13, 1cf5 */
BMP_C(0xe8000000) << (BMP_BIT - 32), /* 182 -- 6, 3a */
BMP_C(0xea000000) << (BMP_BIT - 32), /* 183 -- 7, 75 */
BMP_C(0xea820000) << (BMP_BIT - 32), /* 184 -- 16, ea82 */
BMP_C(0xec000000) << (BMP_BIT - 32), /* 185 -- 6, 3b */
BMP_C(0xf0000000) << (BMP_BIT - 32), /* 186 -- 4, f */
BMP_C(0xf0b80000) << (BMP_BIT - 32), /* 187 -- 16, f0b8 */
BMP_C(0xf1300000) << (BMP_BIT - 32), /* 188 -- 12, f13 */
BMP_C(0xf4000000) << (BMP_BIT - 32), /* 189 -- 8, f4 */
BMP_C(0xf4acfb13) << (BMP_BIT - 32), /* 190 -- 32,f4acfb13 */
BMP_C(0xf5b00000) << (BMP_BIT - 32), /* 191 -- 12, f5b */
BMP_C(0xf6400000) << (BMP_BIT - 32), /* 192 -- 10, 3d9 */
BMP_C(0xf7000000) << (BMP_BIT - 32), /* 193 -- 8, f7 */
BMP_C(0xf8000000) << (BMP_BIT - 32), /* 194 -- 5, 1f */
BMP_C(0xfc000000) << (BMP_BIT - 32), /* 195 -- 6, 3f */
BMP_C(0xfc891918) << (BMP_BIT - 32), /* 196 -- 32,fc891918 */
BMP_C(0xfd000000) << (BMP_BIT - 32), /* 197 -- 8, fd */
BMP_C(0xfe000000) << (BMP_BIT - 32), /* 198 -- 7, 7f */
BMP_C(0xfedcba00) << (BMP_BIT - 32), /* 199 -- 24, fedcba */
BMP_C(0xfee80000) << (BMP_BIT - 32), /* 200 -- 16, fee8 */
BMP_C(0xff000000) << (BMP_BIT - 32), /* 201 -- 8, ff */
BMP_C(0xffc00000) << (BMP_BIT - 32), /* 202 -- 10, 3ff */
BMP_C(0xfff00000) << (BMP_BIT - 32), /* 203 -- 12, fff */
BMP_C(0xfffc0000) << (BMP_BIT - 32), /* 204 -- 14, 3fff */
BMP_C(0xffff0000) << (BMP_BIT - 32), /* 205 -- 16, ffff */
BMP_C(0xffffff00) << (BMP_BIT - 32), /* 206 -- 24, ffffff */
BMP_C(0xfffffffc) << (BMP_BIT - 32), /* 207 -- 30,3fffffff */
BMP_C(0xfffffffe) << (BMP_BIT - 32), /* 208 -- 31,7fffffff */
BMP_C(0xffffffff) << (BMP_BIT - 32), /* 209 -- 32,ffffffff */
BMP_C(0x00010000) << (BMP_BIT - 32), /* 1 -- 16, 0001 */
BMP_C(0x00020000) << (BMP_BIT - 32), /* 2 -- 15, 0001 */
BMP_C(0x00065b00) << (BMP_BIT - 32), /* 3 -- 24, 00065b */
BMP_C(0x007e0000) << (BMP_BIT - 32), /* 4 -- 16, 007e */
BMP_C(0x007f0000) << (BMP_BIT - 32), /* 5 -- 16, 007f */
BMP_C(0x03400000) << (BMP_BIT - 32), /* 6 -- 11, 01a */
BMP_C(0x0376e6e7) << (BMP_BIT - 32), /* 7 -- 32,0376e6e7 */
BMP_C(0x04c11db7) << (BMP_BIT - 32), /* 8 -- 32,04c11db7 */
BMP_C(0x05890000) << (BMP_BIT - 32), /* 9 -- 16, 0589 */
BMP_C(0x07000000) << (BMP_BIT - 32), /* 10 -- 8, 07 */
BMP_C(0x080b0000) << (BMP_BIT - 32), /* 11 -- 16, 080b */
BMP_C(0x09823b6e) << (BMP_BIT - 32), /* 12 -- 31,04c11db7 */
BMP_C(0x0b3c0000) << (BMP_BIT - 32), /* 13 -- 15, 059e */
BMP_C(0x0c000000) << (BMP_BIT - 32), /* 14 -- 6, 03 */
BMP_C(0x0c200000) << (BMP_BIT - 32), /* 15 -- 11, 061 */
BMP_C(0x0c780000) << (BMP_BIT - 32), /* 16 -- 14, 031e */
BMP_C(0x0fb30000) << (BMP_BIT - 32), /* 17 -- 16, 0fb3 */
BMP_C(0x10210000) << (BMP_BIT - 32), /* 18 -- 16, 1021 */
BMP_C(0x12000000) << (BMP_BIT - 32), /* 19 -- 7, 09 */
BMP_C(0x130d2afc) << (BMP_BIT - 32), /* 20 -- 30,04c34abf */
BMP_C(0x144e6300) << (BMP_BIT - 32), /* 21 -- 24, 144e63 */
BMP_C(0x15000000) << (BMP_BIT - 32), /* 22 -- 8, 15 */
BMP_C(0x1697d06a) << (BMP_BIT - 32), /* 23 -- 32,1697d06a */
BMP_C(0x17800000) << (BMP_BIT - 32), /* 24 -- 12, 178 */
BMP_C(0x18000000) << (BMP_BIT - 32), /* 25 -- 6, 06 */
BMP_C(0x19d3c8d8) << (BMP_BIT - 32), /* 26 -- 31,0ce9e46c */
BMP_C(0x1c000000) << (BMP_BIT - 32), /* 27 -- 6, 07 */
BMP_C(0x1d000000) << (BMP_BIT - 32), /* 28 -- 8, 1d */
BMP_C(0x1d0f0000) << (BMP_BIT - 32), /* 29 -- 16, 1d0f */
BMP_C(0x1dcf0000) << (BMP_BIT - 32), /* 30 -- 16, 1dcf */
BMP_C(0x1edc6f41) << (BMP_BIT - 32), /* 31 -- 32,1edc6f41 */
BMP_C(0x1f23b800) << (BMP_BIT - 32), /* 32 -- 24, 1f23b8 */
BMP_C(0x20000000) << (BMP_BIT - 32), /* 33 -- 4, 2 */
BMP_C(0x200fa500) << (BMP_BIT - 32), /* 34 -- 24, 200fa5 */
BMP_C(0x20140000) << (BMP_BIT - 32), /* 35 -- 14, 0805 */
BMP_C(0x20b40000) << (BMP_BIT - 32), /* 36 -- 14, 082d */
BMP_C(0x20fe0000) << (BMP_BIT - 32), /* 37 -- 16, 20fe */
BMP_C(0x21890000) << (BMP_BIT - 32), /* 38 -- 16, 2189 */
BMP_C(0x21cf0200) << (BMP_BIT - 32), /* 39 -- 24, 21cf02 */
BMP_C(0x23ef5200) << (BMP_BIT - 32), /* 40 -- 24, 23ef52 */
BMP_C(0x25000000) << (BMP_BIT - 32), /* 41 -- 8, 25 */
BMP_C(0x26000000) << (BMP_BIT - 32), /* 42 -- 8, 26 */
BMP_C(0x26b10000) << (BMP_BIT - 32), /* 43 -- 16, 26b1 */
BMP_C(0x27818000) << (BMP_BIT - 32), /* 44 -- 17, 04f03 */
BMP_C(0x27d00000) << (BMP_BIT - 32), /* 45 -- 13, 04fa */
BMP_C(0x28000000) << (BMP_BIT - 32), /* 46 -- 5, 05 */
BMP_C(0x29b10000) << (BMP_BIT - 32), /* 47 -- 16, 29b1 */
BMP_C(0x2f000000) << (BMP_BIT - 32), /* 48 -- 8, 2f */
BMP_C(0x30000000) << (BMP_BIT - 32), /* 49 -- 4, 3/ 5, 6 */
BMP_C(0x3010bf7f) << (BMP_BIT - 32), /* 50 -- 32,3010bf7f */
BMP_C(0x31000000) << (BMP_BIT - 32), /* 51 -- 8, 31 */
BMP_C(0x31800000) << (BMP_BIT - 32), /* 52 -- 10, 0c6 */
BMP_C(0x31c30000) << (BMP_BIT - 32), /* 53 -- 16, 31c3 */
BMP_C(0x328b6300) << (BMP_BIT - 32), /* 54 -- 24, 328b63 */
BMP_C(0x34000000) << (BMP_BIT - 32), /* 55 -- 6, 0d */
BMP_C(0x340bc6d9) << (BMP_BIT - 32), /* 56 -- 32,340bc6d9 */
BMP_C(0x37000000) << (BMP_BIT - 32), /* 57 -- 8, 37 */
BMP_C(0x38000000) << (BMP_BIT - 32), /* 58 -- 5, 07 */
BMP_C(0x39000000) << (BMP_BIT - 32), /* 59 -- 8, 39 */
BMP_C(0x3d650000) << (BMP_BIT - 32), /* 60 -- 16, 3d65 */
BMP_C(0x3e000000) << (BMP_BIT - 32), /* 61 -- 8, 3e */
BMP_C(0x40000000) << (BMP_BIT - 32), /* 62 -- 3, 2 */
BMP_C(0x42000000) << (BMP_BIT - 32), /* 63 -- 8, 42 */
BMP_C(0x44c20000) << (BMP_BIT - 32), /* 64 -- 16, 44c2 */
BMP_C(0x45270551) << (BMP_BIT - 32), /* 65 -- 32,45270551 */
BMP_C(0x48000000) << (BMP_BIT - 32), /* 66 -- 5, 09 */
BMP_C(0x49000000) << (BMP_BIT - 32), /* 67 -- 8, 49 */
BMP_C(0x4a800000) << (BMP_BIT - 32), /* 68 -- 10, 12a */
BMP_C(0x4acc0000) << (BMP_BIT - 32), /* 69 -- 15, 2566 */
BMP_C(0x4b000000) << (BMP_BIT - 32), /* 70 -- 8, 4b */
BMP_C(0x4b370000) << (BMP_BIT - 32), /* 71 -- 16, 4b37 */
BMP_C(0x4c000000) << (BMP_BIT - 32), /* 72 -- 6, 13 */
BMP_C(0x4c060000) << (BMP_BIT - 32), /* 73 -- 16, 4c06 */
BMP_C(0x53000000) << (BMP_BIT - 32), /* 74 -- 8, 53 */
BMP_C(0x55000000) << (BMP_BIT - 32), /* 75 -- 8, 55 */
BMP_C(0x55555500) << (BMP_BIT - 32), /* 76 -- 24, 555555 */
BMP_C(0x59350000) << (BMP_BIT - 32), /* 77 -- 16, 5935 */
BMP_C(0x5d380000) << (BMP_BIT - 32), /* 78 -- 16, 5d38 */
BMP_C(0x5d400000) << (BMP_BIT - 32), /* 79 -- 10, 175 */
BMP_C(0x5d6dcb00) << (BMP_BIT - 32), /* 80 -- 24, 5d6dcb */
BMP_C(0x60000000) << (BMP_BIT - 32), /* 81 -- 3, 3 */
BMP_C(0x60e00000) << (BMP_BIT - 32), /* 82 -- 11, 307 */
BMP_C(0x63d00000) << (BMP_BIT - 32), /* 83 -- 16, 63d0 */
BMP_C(0x64000000) << (BMP_BIT - 32), /* 84 -- 6, 19 */
BMP_C(0x66400000) << (BMP_BIT - 32), /* 85 -- 10, 199 */
BMP_C(0x66c50000) << (BMP_BIT - 32), /* 86 -- 16, 66c5 */
BMP_C(0x6f630000) << (BMP_BIT - 32), /* 87 -- 16, 6f63 */
BMP_C(0x6f910000) << (BMP_BIT - 32), /* 88 -- 16, 6f91 */
BMP_C(0x70000000) << (BMP_BIT - 32), /* 89 -- 4, 7 */
BMP_C(0x70a00000) << (BMP_BIT - 32), /* 90 -- 11, 385 */
BMP_C(0x755b0000) << (BMP_BIT - 32), /* 91 -- 16, 755b */
BMP_C(0x765e7680) << (BMP_BIT - 32), /* 92 -- 32,765e7680 */
BMP_C(0x76c20800) << (BMP_BIT - 32), /* 93 -- 32, 0ed841 */
BMP_C(0x7979bd00) << (BMP_BIT - 32), /* 94 -- 24, 7979bd */
BMP_C(0x7e000000) << (BMP_BIT - 32), /* 95 -- 8, 7e */
BMP_C(0x80000000) << (BMP_BIT - 32), /* 96 -- 3, 4 */
BMP_C(0x80006300) << (BMP_BIT - 32), /* 97 -- 24, 800063 */
BMP_C(0x80050000) << (BMP_BIT - 32), /* 98 -- 16, 8005 */
BMP_C(0x800d0000) << (BMP_BIT - 32), /* 99 -- 16, 800d */
BMP_C(0x800fe300) << (BMP_BIT - 32), /* 100 -- 24, 800fe3 */
BMP_C(0x80b40000) << (BMP_BIT - 32), /* 101 -- 14, 202d */
BMP_C(0x80c2e71c) << (BMP_BIT - 32), /* 102 -- 30,2030b9c7 */
BMP_C(0x80f00000) << (BMP_BIT - 32), /* 103 -- 12, 80f */
BMP_C(0x814141ab) << (BMP_BIT - 32), /* 104 -- 32,814141ab */
BMP_C(0x8144c800) << (BMP_BIT - 32), /* 105 -- 21, 102899 */
BMP_C(0x864cfb00) << (BMP_BIT - 32), /* 106 -- 24, 864cfb */
BMP_C(0x87315576) << (BMP_BIT - 32), /* 107 -- 32,87315576 */
BMP_C(0x89ec0000) << (BMP_BIT - 32), /* 108 -- 16, 89ec */
BMP_C(0x8a000000) << (BMP_BIT - 32), /* 109 -- 7, 45 */
BMP_C(0x8b320000) << (BMP_BIT - 32), /* 110 -- 15, 4599 */
BMP_C(0x8bb70000) << (BMP_BIT - 32), /* 111 -- 16, 8bb7 */
BMP_C(0x8cc00000) << (BMP_BIT - 32), /* 112 -- 10, 233 */
BMP_C(0x904cddbf) << (BMP_BIT - 32), /* 113 -- 32,904cddbf */
BMP_C(0x906e0000) << (BMP_BIT - 32), /* 114 -- 16, 906e */
BMP_C(0x94000000) << (BMP_BIT - 32), /* 115 -- 8, 94 */
BMP_C(0x97000000) << (BMP_BIT - 32), /* 116 -- 8, 97 */
BMP_C(0x98000000) << (BMP_BIT - 32), /* 117 -- 6, 26 */
BMP_C(0x99000000) << (BMP_BIT - 32), /* 118 -- 8, 99 */
BMP_C(0x9b000000) << (BMP_BIT - 32), /* 119 -- 8, 9b */
BMP_C(0x9c000000) << (BMP_BIT - 32), /* 120 -- 6, 27 */
BMP_C(0x9d5e4de2) << (BMP_BIT - 32), /* 121 -- 31,4eaf26f1 */
BMP_C(0x9e000000) << (BMP_BIT - 32), /* 122 -- 7, 4f */
BMP_C(0x9ecf0000) << (BMP_BIT - 32), /* 123 -- 16, 9ecf */
BMP_C(0xa0660000) << (BMP_BIT - 32), /* 124 -- 16, a066 */
BMP_C(0xa0970000) << (BMP_BIT - 32), /* 125 -- 16, a097 */
BMP_C(0xa1000000) << (BMP_BIT - 32), /* 126 -- 8, a1 */
BMP_C(0xa3660000) << (BMP_BIT - 32), /* 127 -- 16, a366 */
BMP_C(0xa6000000) << (BMP_BIT - 32), /* 128 -- 7, 53 */
BMP_C(0xa7000000) << (BMP_BIT - 32), /* 129 -- 8, a7 */
BMP_C(0xa8000000) << (BMP_BIT - 32), /* 130 -- 5, 15 */
BMP_C(0xa8190000) << (BMP_BIT - 32), /* 131 -- 16, a819 */
BMP_C(0xa833982b) << (BMP_BIT - 32), /* 132 -- 32,a833982b */
BMP_C(0xabcdef00) << (BMP_BIT - 32), /* 133 -- 24, abcdef */
BMP_C(0xac000000) << (BMP_BIT - 32), /* 134 -- 8, ac */
BMP_C(0xaee70000) << (BMP_BIT - 32), /* 135 -- 16, aee7 */
BMP_C(0xb0000000) << (BMP_BIT - 32), /* 136 -- 4, b */
BMP_C(0xb0010000) << (BMP_BIT - 32), /* 137 -- 16, b001 */
BMP_C(0xb2aa0000) << (BMP_BIT - 32), /* 138 -- 16, b2aa */
BMP_C(0xb3400000) << (BMP_BIT - 32), /* 139 -- 12, b34 */
BMP_C(0xb42d8000) << (BMP_BIT - 32), /* 140 -- 17, 1685b */
BMP_C(0xb4600000) << (BMP_BIT - 32), /* 141 -- 11, 5a3 */
BMP_C(0xb4c80000) << (BMP_BIT - 32), /* 142 -- 16, b4c8 */
BMP_C(0xb4f3e600) << (BMP_BIT - 32), /* 143 -- 24, b4f3e6 */
BMP_C(0xb704ce00) << (BMP_BIT - 32), /* 144 -- 24, b704ce */
BMP_C(0xb798b438) << (BMP_BIT - 32), /* 145 -- 32,b798b438 */
BMP_C(0xbb3d0000) << (BMP_BIT - 32), /* 146 -- 16, bb3d */
BMP_C(0xbc000000) << (BMP_BIT - 32), /* 147 -- 6,2f/ 8,bc */
BMP_C(0xbd0be338) << (BMP_BIT - 32), /* 148 -- 32,bd0be338 */
BMP_C(0xbdf40000) << (BMP_BIT - 32), /* 149 -- 16, bdf4 */
BMP_C(0xbf050000) << (BMP_BIT - 32), /* 150 -- 16, bf05 */
BMP_C(0xc0000000) << (BMP_BIT - 32), /* 151 -- 3, 6 */
BMP_C(0xc2000000) << (BMP_BIT - 32), /* 152 -- 7, 61 */
BMP_C(0xc25a5600) << (BMP_BIT - 32), /* 153 -- 24, c25a56 */
BMP_C(0xc2b70000) << (BMP_BIT - 32), /* 154 -- 16, c2b7 */
BMP_C(0xc2b80000) << (BMP_BIT - 32), /* 155 -- 14, 30ae */
BMP_C(0xc4000000) << (BMP_BIT - 32), /* 156 -- 8, c4 */
BMP_C(0xc6c60000) << (BMP_BIT - 32), /* 157 -- 16, c6c6 */
BMP_C(0xc7000000) << (BMP_BIT - 32), /* 158 -- 8, c7 */
BMP_C(0xc704dd7b) << (BMP_BIT - 32), /* 159 -- 32,c704dd7b */
BMP_C(0xc8000000) << (BMP_BIT - 32), /* 160 -- 5, 19 */
BMP_C(0xc8670000) << (BMP_BIT - 32), /* 161 -- 16, c867 */
BMP_C(0xcbf43926) << (BMP_BIT - 32), /* 162 -- 32,cbf43926 */
BMP_C(0xcde70300) << (BMP_BIT - 32), /* 163 -- 24, cde703 */
BMP_C(0xce3c0000) << (BMP_BIT - 32), /* 164 -- 16, ce3c */
BMP_C(0xd0000000) << (BMP_BIT - 32), /* 165 -- 8, d0 */
BMP_C(0xd02a0000) << (BMP_BIT - 32), /* 166 -- 15, 6815 */
BMP_C(0xd0db0000) << (BMP_BIT - 32), /* 167 -- 16, d0db */
BMP_C(0xd3100000) << (BMP_BIT - 32), /* 168 -- 12, d31 */
BMP_C(0xd3be9568) << (BMP_BIT - 32), /* 169 -- 30,34efa55a */
BMP_C(0xd4d00000) << (BMP_BIT - 32), /* 170 -- 12, d4d */
BMP_C(0xd5000000) << (BMP_BIT - 32), /* 171 -- 8, d5 */
BMP_C(0xd64e0000) << (BMP_BIT - 32), /* 172 -- 16, d64e */
BMP_C(0xda000000) << (BMP_BIT - 32), /* 173 -- 8, da */
BMP_C(0xdaf00000) << (BMP_BIT - 32), /* 174 -- 12, daf */
BMP_C(0xdebb20e3) << (BMP_BIT - 32), /* 175 -- 32,debb20e3 */
BMP_C(0xdf000000) << (BMP_BIT - 32), /* 176 -- 8, df */
BMP_C(0xe0000000) << (BMP_BIT - 32), /* 177 -- 3, 7 */
BMP_C(0xe3069283) << (BMP_BIT - 32), /* 178 -- 32,e3069283 */
BMP_C(0xe3940000) << (BMP_BIT - 32), /* 179 -- 16, e394 */
BMP_C(0xe5cc0000) << (BMP_BIT - 32), /* 180 -- 16, e5cc */
BMP_C(0xe7a80000) << (BMP_BIT - 32), /* 181 -- 13, 1cf5 */
BMP_C(0xe8000000) << (BMP_BIT - 32), /* 182 -- 6, 3a */
BMP_C(0xea000000) << (BMP_BIT - 32), /* 183 -- 7, 75 */
BMP_C(0xea820000) << (BMP_BIT - 32), /* 184 -- 16, ea82 */
BMP_C(0xec000000) << (BMP_BIT - 32), /* 185 -- 6, 3b */
BMP_C(0xf0000000) << (BMP_BIT - 32), /* 186 -- 4, f */
BMP_C(0xf0b80000) << (BMP_BIT - 32), /* 187 -- 16, f0b8 */
BMP_C(0xf1300000) << (BMP_BIT - 32), /* 188 -- 12, f13 */
BMP_C(0xf4000000) << (BMP_BIT - 32), /* 189 -- 8, f4 */
BMP_C(0xf4acfb13) << (BMP_BIT - 32), /* 190 -- 32,f4acfb13 */
BMP_C(0xf5b00000) << (BMP_BIT - 32), /* 191 -- 12, f5b */
BMP_C(0xf6400000) << (BMP_BIT - 32), /* 192 -- 10, 3d9 */
BMP_C(0xf7000000) << (BMP_BIT - 32), /* 193 -- 8, f7 */
BMP_C(0xf8000000) << (BMP_BIT - 32), /* 194 -- 5, 1f */
BMP_C(0xfc000000) << (BMP_BIT - 32), /* 195 -- 6, 3f */
BMP_C(0xfc891918) << (BMP_BIT - 32), /* 196 -- 32,fc891918 */
BMP_C(0xfd000000) << (BMP_BIT - 32), /* 197 -- 8, fd */
BMP_C(0xfe000000) << (BMP_BIT - 32), /* 198 -- 7, 7f */
BMP_C(0xfedcba00) << (BMP_BIT - 32), /* 199 -- 24, fedcba */
BMP_C(0xfee80000) << (BMP_BIT - 32), /* 200 -- 16, fee8 */
BMP_C(0xff000000) << (BMP_BIT - 32), /* 201 -- 8, ff */
BMP_C(0xffc00000) << (BMP_BIT - 32), /* 202 -- 10, 3ff */
BMP_C(0xfff00000) << (BMP_BIT - 32), /* 203 -- 12, fff */
BMP_C(0xfffc0000) << (BMP_BIT - 32), /* 204 -- 14, 3fff */
BMP_C(0xffff0000) << (BMP_BIT - 32), /* 205 -- 16, ffff */
BMP_C(0xffffff00) << (BMP_BIT - 32), /* 206 -- 24, ffffff */
BMP_C(0xfffffffc) << (BMP_BIT - 32), /* 207 -- 30,3fffffff */
BMP_C(0xfffffffe) << (BMP_BIT - 32), /* 208 -- 31,7fffffff */
BMP_C(0xffffffff) << (BMP_BIT - 32), /* 209 -- 32,ffffffff */
};
static const struct malias aliases[];