we are using GNU extensions, using __builtin_bswap* is fine.

This commit is contained in:
2025-07-07 11:47:13 +02:00
parent c56e2399e9
commit 9b9a20e226
4 changed files with 12 additions and 95 deletions

View File

@@ -7,12 +7,6 @@
#include "test.h"
testdat tests[] = {
{"", test_bswap16, (u16[]){0x11EE, 0xEE11} },
{"", test_bswap32, (u32[]){0x1142ADEE, 0xEEAD4211} },
{"", test_bswap64, (u64[]){0x114266897799ADEE, 0xEEAD997789664211} },
{"", test_bswap16_impl, (u16[]){0x11EE, 0xEE11} },
{"", test_bswap32_impl, (u32[]){0x1142ADEE, 0xEEAD4211} },
{"", test_bswap64_impl, (u64[]){0x114266897799ADEE, 0xEEAD997789664211} },
{"k=v", test_procbuf, &(struct test_procbuf){"key=val", "key", "val", 0} },
{"sometxt", test_procbuf, &(struct test_procbuf){"sometxt", "sometxt", "", CONF_ESYNTAX} },
{"comment", test_procbuf, &(struct test_procbuf){"# comment", "", "", CONF_ENODAT} },

View File

@@ -2,8 +2,6 @@
#include <stdint.h>
#include "../src/util/colour32.h"
#include "../src/util/compat/bswap.h"
#include "../src/util/types.h"
#include "test.h"
int test_colour32_endianess(void *d) {
@@ -11,33 +9,3 @@ int test_colour32_endianess(void *d) {
colour32 c = {0xFF000000}; // setting just the red channel
return assert_true(c.ch.r == 0xFF);
}
int test_bswap16(void *d) {
u16 *arg = d;
return assert_true(bswap16(arg[0]) == arg[1]);
}
int test_bswap32(void *d) {
u32 *arg = d;
return assert_true(bswap32(arg[0]) == arg[1]);
}
int test_bswap64(void *d) {
u64 *arg = d;
return assert_true(bswap64(arg[0]) == arg[1]);
}
int test_bswap16_impl(void *d) {
u16 *arg = d;
return assert_true(bswap16_impl(arg[0]) == arg[1]);
}
int test_bswap32_impl(void *d) {
u32 *arg = d;
return assert_true(bswap32_impl(arg[0]) == arg[1]);
}
int test_bswap64_impl(void *d) {
u64 *arg = d;
return assert_true(bswap64_impl(arg[0]) == arg[1]);
}