Xonotic
unsafe.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _strid(s)   ITOF(reinterpret_cast(int, s))
 
#define ARRAY_INDEX(T, arr, idx)   (reinterpret_cast(T##_fld, reinterpret_cast(int, arr[0]) + FTOI(idx)))
 
#define FTOI(f)   ((f) * INTEGER_ONE)
 
#define ITOF(i)   ((i) / INTEGER_ONE)
 
#define reinterpret_cast(T, it)   _unsafe_cast_##T(0, it)
 
#define strid(s)   stof(sprintf("%i", s))
 
#define X(T)
 

Functions

 STATIC_INIT (INTEGER_ONE)
 
 X (bool) X(int) X(float) X(vector) X(entity) X(string) using rawfunc
 
 X (rawfunc) .int _unsafe_fld1
 

Variables

 _unsafe_fld2
 
int INTEGER_ONE
 

Macro Definition Documentation

◆ _strid

#define _strid (   s)    ITOF(reinterpret_cast(int, s))

◆ ARRAY_INDEX

#define ARRAY_INDEX (   T,
  arr,
  idx 
)    (reinterpret_cast(T##_fld, reinterpret_cast(int, arr[0]) + FTOI(idx)))

Definition at line 31 of file unsafe.qh.

◆ FTOI

#define FTOI (   f)    ((f) * INTEGER_ONE)

Definition at line 23 of file unsafe.qh.

◆ ITOF

#define ITOF (   i)    ((i) / INTEGER_ONE)

Definition at line 24 of file unsafe.qh.

◆ reinterpret_cast

#define reinterpret_cast (   T,
  it 
)    _unsafe_cast_##T(0, it)

Definition at line 3 of file unsafe.qh.

Referenced by STATIC_INIT().

◆ strid

#define strid (   s)    stof(sprintf("%i", s))

◆ X

#define X (   T)
Value:
T _unsafe_cast_##T(int dummy, ...) { return ...(0, T); } \
USING(T##_fld, .T); T##_fld _unsafe_cast_##T##_fld(int dummy, ...) { return ...(0, T##_fld); }

Definition at line 4 of file unsafe.qh.

Function Documentation

◆ STATIC_INIT()

STATIC_INIT ( INTEGER_ONE  )

Definition at line 26 of file unsafe.qh.

References reinterpret_cast.

27 {
28  INTEGER_ONE = reinterpret_cast(int, _unsafe_fld2) - reinterpret_cast(int, _unsafe_fld1);
29 }
int INTEGER_ONE
Definition: unsafe.qh:21
_unsafe_fld2
Definition: unsafe.qh:20
#define reinterpret_cast(T, it)
Definition: unsafe.qh:3

◆ X() [1/2]

X ( bool  )

◆ X() [2/2]

X ( rawfunc  )

Variable Documentation

◆ _unsafe_fld2

_unsafe_fld2

Definition at line 20 of file unsafe.qh.

◆ INTEGER_ONE

int INTEGER_ONE

Definition at line 21 of file unsafe.qh.