Starting to build a codebase for messing with assembly generation compatible with yasm

This commit is contained in:
2024-11-29 14:31:38 -05:00
parent 531daa38c1
commit 80c830b59d
18 changed files with 26940 additions and 1 deletions

25
source/base/memory.h Normal file
View File

@ -0,0 +1,25 @@
#ifdef INTELLISENSE_DIRECTIVES
# pragma once
# include "debug.h"
#endif
#pragma region Memory
#define kilobytes( x ) ( ( x ) * ( s64 )( 1024 ) )
#define megabytes( x ) ( kilobytes( x ) * ( s64 )( 1024 ) )
#define gigabytes( x ) ( megabytes( x ) * ( s64 )( 1024 ) )
#define terabytes( x ) ( gigabytes( x ) * ( s64 )( 1024 ) )
#define _ONES ( cast( usize, - 1) / U8_MAX )
#define _HIGHS ( GEN__ONES * ( U8_MAX / 2 + 1 ) )
#define _HAS_ZERO( x ) ( ( ( x ) - _ONES ) & ~( x ) & _HIGHS )
#define swap( a, b ) \
do { \
typeof(a) \
temp = (a); \
(a) = (b); \
(b) = temp; \
} while(0)
#pragma endregion Memory