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)
 
#define N_ARGB(a, r, g, b)
 
#define N_RGBA(r, g, b, a)
 
#define N_XRGB(r, g, b)
 
#define N_COLORVALUE(r, g, b, a)
 
#define BITS_TO_BYTES(x)
 
#define BYTES_TO_BITS(x)
 
#define lengthof(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)
Value:
(((x)+7)>>3)

◆ BYTES_TO_BITS

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

◆ lengthof

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

◆ N_ARGB

#define N_ARGB ( a,
r,
g,
b )
Value:
((uint)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
unsigned int uint
Definition types.h:31

◆ N_BIT

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

◆ N_COLORVALUE

#define N_COLORVALUE ( r,
g,
b,
a )
Value:
N_RGBA((uint)((r)*255.f),(uint)((g)*255.f),(uint)((b)*255.f),(uint)((a)*255.f))
#define N_RGBA(r, g, b, a)
Definition types.h:105

◆ N_RGBA

#define N_RGBA ( r,
g,
b,
a )
Value:
N_ARGB(a,r,g,b)
#define N_ARGB(a, r, g, b)
Definition types.h:104

◆ N_XRGB

#define N_XRGB ( r,
g,
b )
Value:
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 PtrDiff

◆ ptrdiff

typedef ptrdiff_t 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 >
bool AllBits ( const FLAGS flags,
const BITS bits )
constexpr

Check if all bits are set in flags.

◆ AnyBits()

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

Check if any bits are set in flags.

◆ OnlyBits()

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

◆ operator""_GB()

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

◆ operator""_KB()

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

◆ operator""_MB()

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

◆ SetBits()

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

◆ UnsetBits()

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

Variable Documentation

◆ InvalidIndex

const int InvalidIndex = -1
static