Fix missing builtins in C programs linking with compiler_builtins (#17475)
This commit is contained in:
19
programs/bpf/c/src/float/float.c
Normal file
19
programs/bpf/c/src/float/float.c
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @brief Example C based BPF program that performs operations
|
||||
* on floating point values. The test fails if floating point
|
||||
* emulation functions were not linked to the module.
|
||||
*/
|
||||
#include <solana_sdk.h>
|
||||
|
||||
extern uint64_t entrypoint(const uint8_t *input) {
|
||||
SolAccountInfo ka[1];
|
||||
SolParameters params = (SolParameters) { .ka = ka };
|
||||
|
||||
if (!sol_deserialize(input, ¶ms, SOL_ARRAY_SIZE(ka))) {
|
||||
return ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
uint32_t *data = (uint32_t *)(params.ka[0].data);
|
||||
*data += 1.5;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user