X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=util.c;h=b1d5c5ba37bc589e89611358fac2fd3c783e727d;hp=e1f90bd6d2a004c05a695455fd662b9f7808abb9;hb=53e9ed0d9638b911d377df28505f09c0bee62a35;hpb=52adc2113fd0235e5f8926fd2a8f365243117710 diff --git a/util.c b/util.c index e1f90bd..b1d5c5b 100644 --- a/util.c +++ b/util.c @@ -58,7 +58,7 @@ const char *util_instr_str[VINSTR_END] = { * only required if big endian .. otherwise no need to swap * data. */ -#if PLATFORM_BYTE_ORDER == GMQCC_BYTE_ORDER_BIG +#if PLATFORM_BYTE_ORDER == GMQCC_BYTE_ORDER_BIG || PLATFORM_BYTE_ORDER == -1 static GMQCC_INLINE void util_swap16(uint16_t *d, size_t l) { while (l--) { d[l] = (d[l] << 8) | (d[l] >> 8); @@ -129,7 +129,7 @@ void util_endianswap(void *_data, size_t count, unsigned int typesize) { #endif } -void util_swap_header (prog_header_t *code_header) { +void util_swap_header(prog_header_t *code_header) { util_endianswap(&code_header->version, 1, sizeof(code_header->version)); util_endianswap(&code_header->crc16, 1, sizeof(code_header->crc16)); util_endianswap(&code_header->statements.offset, 1, sizeof(code_header->statements.offset)); @@ -147,7 +147,7 @@ void util_swap_header (prog_header_t *code_header) { util_endianswap(&code_header->entfield, 1, sizeof(code_header->entfield)); } -void util_swap_statements (prog_section_statement_t *statements) { +void util_swap_statements(prog_section_statement_t *statements) { size_t i; for (i = 0; i < vec_size(statements); ++i) { @@ -158,7 +158,7 @@ void util_swap_statements (prog_section_statement_t *statements) { } } -void util_swap_defs_fields (prog_section_both_t *section) { +void util_swap_defs_fields(prog_section_both_t *section) { size_t i; for (i = 0; i < vec_size(section); ++i) { @@ -168,7 +168,7 @@ void util_swap_defs_fields (prog_section_both_t *section) { } } -void util_swap_functions (prog_section_function_t *functions) { +void util_swap_functions(prog_section_function_t *functions) { size_t i; for (i = 0; i < vec_size(functions); ++i) { @@ -183,7 +183,7 @@ void util_swap_functions (prog_section_function_t *functions) { } } -void util_swap_globals (int32_t *globals) { +void util_swap_globals(int32_t *globals) { util_endianswap(globals, vec_size(globals), sizeof(int32_t)); }