Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

F.4.1 Mixed Integer/Floating-Point Extern Calls

The C backend supports the same low-level __call_extern_mixed_N__ intrinsic family used by the native backends. The static tag arguments are:

  • 0: pass the value as udewy_word
  • 1: reinterpret the value's low 32 bits as float
  • 2: reinterpret the value as double

This is the correct path for C APIs that take floating-point arguments, such as OpenGL functions. The SDL/OpenGL wrapper in udewy/third_party/sdl/sdl.udewy uses this pattern so that the same wrapper can target native Linux backends and the C backend.

The C backend also supports __i64_to_f32_bits__, __i64_to_f64_bits__, __f32_bits_to_i64__, and __f64_bits_to_i64__, which convert signed integer values into IEEE-754 bit patterns for use with mixed extern calls and convert returned/stored float bit patterns back to integers.