Formatting.

This commit is contained in:
Tijani Lawal 2024-08-06 16:49:26 -05:00
parent 5f0ef9c0dd
commit b4cfc14d3b
7 changed files with 94 additions and 74 deletions

View File

@ -5,29 +5,29 @@ AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
Enabled: true
AcrossEmptyLines: true
AcrossComments: false
AlignCompound: false
AlignCompound: true
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
Enabled: true
AcrossEmptyLines: true
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignCompound: true
PadOperators: true
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
Enabled: true
AcrossEmptyLines: true
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignCompound: true
PadOperators: true
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
Enabled: true
AcrossEmptyLines: true
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignCompound: true
PadOperators: true
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true

View File

@ -1,6 +1,21 @@
#ifndef BASE_ARENA_H
#define BASE_ARENA_H
// Arena allocator simulates how stack memory works.
// This allows us the ability to allocate a reasonableamount of memory
// at startup and only use that allocated amount of memory throughout
// the lifetime of the application. Obviously this still uses
// "malloc, free, VirtualAlloc, VirtualFree" but instead of having to
// request and freeing memory during runtime, we create an environment
// where we have as much memory we could ever need and them portion it
// out in small chunk as needed. This has multiple benefits that would
// make itself glaring throughout the codebase but the gist of it is that
// we have one large block of memory throughout the lifetime,
// then application specific code that could need memory grab a chunck
// memory from the big block of memory we have reserved with the operating
// system at startup do whatever operation it needs to do, then return
// that block of memory back to the arena.
// Constants
#define ARENA_HEADER_SIZE 64

View File

@ -56,4 +56,9 @@ typedef double f64;
// ??(tijani): the calculation of how this works breaks my brain, need to bust out the pen and paper to figure it out.
#define AlignPow2(x, b) (((x) + (b) - 1) & (~((b) - 1)))
// Linkedlist building macros
// Singlely linked lists (stacks)
#define SLLStackPush_N(head, new_node, next) ((new_node)->next = (head), (head) = (new_node))
#define SLLStackPop_N(head, next) ((head) = (head)->next)
#endif // BASE_CORE_H