Fix up bpf numeric types

This commit is contained in:
Michael Vines 2018-10-31 20:28:24 -07:00
parent 00889c5139
commit 5ecb9da801
2 changed files with 19 additions and 6 deletions

View File

@ -10,14 +10,18 @@ extern "C" {
/**
* Numeric types
*/
#ifndef __LP64__
#error LP64 data model required
#endif
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed int int16_t;
typedef unsigned int uint16_t;
typedef signed long int int32_t;
typedef unsigned long int uint32_t;
typedef signed long long int int64_t;
typedef unsigned long long int uint64_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long int int64_t;
typedef unsigned long int uint64_t;
/**
* Boolean type

View File

@ -20,5 +20,14 @@ extern bool entrypoint(const uint8_t *input) {
return false;
}
sol_print_params(NUM_KA, ka, data, data_len);
sol_assert(sizeof(int8_t) == 1);
sol_assert(sizeof(uint8_t) == 1);
sol_assert(sizeof(int16_t) == 2);
sol_assert(sizeof(uint16_t) == 2);
sol_assert(sizeof(int32_t) == 4);
sol_assert(sizeof(uint32_t) == 4);
sol_assert(sizeof(int64_t) == 8);
sol_assert(sizeof(uint64_t) == 8);
return true;
}