Nebula
Loading...
Searching...
No Matches
types.h File Reference
#include "memory/memory.h"
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define N_BIT(x)   (1 << x)
 
#define N_ARGB(a, r, g, b)   ((uint)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
 
#define N_RGBA(r, g, b, a)   N_ARGB(a,r,g,b)
 
#define N_XRGB(r, g, b)   N_ARGB(0xff,r,g,b)
 
#define N_COLORVALUE(r, g, b, a)   N_RGBA((uint)((r)*255.f),(uint)((g)*255.f),(uint)((b)*255.f),(uint)((a)*255.f))
 
#define BITS_TO_BYTES(x)   (((x)+7)>>3)
 
#define BYTES_TO_BITS(x)   ((x)<<3)
 
#define lengthof(x)   (sizeof(x) / sizeof(*x))
 
#define NEBULA_ALIGN16   alignas(16)
 

Typedefs

typedef unsigned long ulong
 
typedef unsigned int uint
 
typedef unsigned short ushort
 
typedef unsigned char uchar
 
typedef unsigned char ubyte
 
typedef uint64_t uint64
 
typedef int64_t int64
 
typedef uint32_t uint32
 
typedef int32_t int32
 
typedef uint16_t uint16
 
typedef int16_t int16
 
typedef uint8_t uint8
 
typedef int8_t int8
 
typedef uintptr_t uintptr
 
typedef ptrdiff_t ptrdiff
 
typedef int IndexT
 
typedef int SizeT
 
typedef int64_t Index64T
 
typedef int64_t Size64T
 
typedef uintptr PtrT
 
typedef ptrdiff PtrDiff
 

Functions

constexpr uint64 operator""_KB (const unsigned long long val)
 
constexpr uint64 operator""_MB (const unsigned long long val)
 
constexpr uint64 operator""_GB (const unsigned long long val)
 
template<class MASK , class BITS >
constexpr MASK SetBits (const MASK mask, const BITS bit)
 
template<class MASK , class BITS >
constexpr MASK UnsetBits (const MASK mask, const BITS bit)
 
template<class FLAGS , class BITS >
constexpr bool AllBits (const FLAGS flags, const BITS bits)
 Check if all bits are set in flags.
 
template<class FLAGS , class BITS >
constexpr bool AnyBits (const FLAGS flags, const BITS bits)
 Check if any bits are set in flags.
 
template<class FLAGS , class BITS >
constexpr bool OnlyBits (const FLAGS flags, const BITS bits)
 

Variables

static const int InvalidIndex = -1
 

Macro Definition Documentation

◆ BITS_TO_BYTES

#define BITS_TO_BYTES ( x)    (((x)+7)>>3)

◆ BYTES_TO_BITS

#define BYTES_TO_BITS ( x)    ((x)<<3)

◆ lengthof

#define lengthof ( x)    (sizeof(x) / sizeof(*x))

◆ N_ARGB

#define N_ARGB ( a,
r,
g,
b )   ((uint)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))

◆ N_BIT

#define N_BIT ( x)    (1 << x)

◆ N_COLORVALUE

#define N_COLORVALUE ( r,
g,
b,
a )   N_RGBA((uint)((r)*255.f),(uint)((g)*255.f),(uint)((b)*255.f),(uint)((a)*255.f))

◆ N_RGBA

#define N_RGBA ( r,
g,
b,
a )   N_ARGB(a,r,g,b)

◆ N_XRGB

#define N_XRGB ( r,
g,
b )   N_ARGB(0xff,r,g,b)

◆ NEBULA_ALIGN16

#define NEBULA_ALIGN16   alignas(16)

Typedef Documentation

◆ Index64T

typedef int64_t Index64T

◆ IndexT

typedef int IndexT

◆ int16

typedef int16_t int16

◆ int32

typedef int32_t int32

◆ int64

typedef int64_t int64

◆ int8

typedef int8_t int8

◆ ptrdiff

typedef ptrdiff_t ptrdiff

◆ PtrDiff

typedef ptrdiff PtrDiff

◆ PtrT

typedef uintptr PtrT

◆ Size64T

typedef int64_t Size64T

◆ SizeT

typedef int SizeT

◆ ubyte

typedef unsigned char ubyte

◆ uchar

typedef unsigned char uchar

◆ uint

typedef unsigned int uint

◆ uint16

typedef uint16_t uint16

◆ uint32

typedef uint32_t uint32

◆ uint64

typedef uint64_t uint64

◆ uint8

typedef uint8_t uint8

◆ uintptr

typedef uintptr_t uintptr

◆ ulong

typedef unsigned long ulong

◆ ushort

typedef unsigned short ushort

Function Documentation

◆ AllBits()

template<class FLAGS , class BITS >
constexpr bool AllBits ( const FLAGS flags,
const BITS bits )
constexpr

Check if all bits are set in flags.

◆ AnyBits()

template<class FLAGS , class BITS >
constexpr bool AnyBits ( const FLAGS flags,
const BITS bits )
constexpr

Check if any bits are set in flags.

◆ OnlyBits()

template<class FLAGS , class BITS >
constexpr bool OnlyBits ( const FLAGS flags,
const BITS bits )
constexpr

◆ operator""_GB()

constexpr uint64 operator""_GB ( const unsigned long long val)
constexpr

◆ operator""_KB()

constexpr uint64 operator""_KB ( const unsigned long long val)
constexpr

◆ operator""_MB()

constexpr uint64 operator""_MB ( const unsigned long long val)
constexpr

◆ SetBits()

template<class MASK , class BITS >
constexpr MASK SetBits ( const MASK mask,
const BITS bit )
constexpr

◆ UnsetBits()

template<class MASK , class BITS >
constexpr MASK UnsetBits ( const MASK mask,
const BITS bit )
constexpr

Variable Documentation

◆ InvalidIndex

const int InvalidIndex = -1
static