Fixes to work with our game. Replay fixes and improvements. Removed shape names (save memory). B3_DEFAULT_CATEGORY_BITS is now UINT64_MAX to make selection easier.
19 lines
1.4 KiB
C
19 lines
1.4 KiB
C
// SPDX-FileCopyrightText: 2026 Erin Catto
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#pragma once
|
|
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
|
|
// Swap two same-size lvalues through a byte buffer. Avoids __typeof__ so it builds on any C compiler.
|
|
#define B3_SWAP( x, y ) \
|
|
do \
|
|
{ \
|
|
_Static_assert( sizeof( x ) == sizeof( y ), "size mismatch" ); \
|
|
char B3_SWAP_TEMP[sizeof( x )]; \
|
|
memcpy( B3_SWAP_TEMP, &( x ), sizeof( x ) ); \
|
|
memcpy( &( x ), &( y ), sizeof( x ) ); \
|
|
memcpy( &( y ), B3_SWAP_TEMP, sizeof( x ) ); \
|
|
} \
|
|
while ( 0 )
|