infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
105_bitfields_fam_jit.c File Reference

End-to-end JIT execution tests for Bitfields and Flexible Array Members. More...

#include "common/compat_c23.h"
#include "common/double_tap.h"
#include <infix/infix.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for 105_bitfields_fam_jit.c:

Classes

struct  BitfieldStruct
struct  FlexStruct

Macros

#define DBLTAP_IMPLEMENTATION

Functions

int check_bitfields (BitfieldStruct bfs)
double sum_flexible_array (FlexStruct *fs)
 subtest ("Bitfields passed by value")
 subtest ("Flexible Array Member passed by pointer")
 infix_arena_destroy (arena)

Variables

 TEST
infix_arena_t * arena = infix_arena_create(4096)

Detailed Description

End-to-end JIT execution tests for Bitfields and Flexible Array Members.

This test validates that the JIT engine correctly handles the data marshaling for types with advanced layout rules.

  1. Bitfields: Verifies that a struct with sub-byte bitfields is passed by value correctly. This ensures the JIT treats the struct as a contiguous block of sized bytes and doesn't corrupt the internal bit packing.
  2. Flexible Array Members (FAM): Verifies that passing a pointer to a struct with a FAM works, allowing the C function to access data beyond the struct's nominal size.

Macro Definition Documentation

◆ DBLTAP_IMPLEMENTATION

#define DBLTAP_IMPLEMENTATION

Function Documentation

◆ check_bitfields()

int check_bitfields ( BitfieldStruct bfs)

◆ infix_arena_destroy()

infix_arena_destroy ( arena )

◆ subtest() [1/2]

subtest ( "Bitfields passed by value" )

◆ subtest() [2/2]

subtest ( "Flexible Array Member passed by pointer" )

◆ sum_flexible_array()

double sum_flexible_array ( FlexStruct * fs)

Variable Documentation

◆ arena

◆ TEST

TEST
Initial value:
{
plan(2)
#define plan(count)
Definition double_tap.h:192