summaryrefslogtreecommitdiffstats
path: root/src/bit.h
Commit message (Collapse)AuthorAgeFilesLines
* build: Move feature test macros to prelude.hTavian Barnes2024-08-281-2/+0
| | | | | | This replaces the explicit CPPFLAGS list in flags.mk with just `-include src/prelude.h`, shortening our compiler command lines and allowing them to be easily documented.
* prelude: Split bfs-specific utilities into new bfs.h headerTavian Barnes2024-08-281-0/+3
|
* prelude: Rely more on __has_include()Tavian Barnes2024-08-281-1/+1
| | | | | Rather than a bunch of manual fallback macros, just provide a fallback definition that returns false.
* bit: Use <stdbit.h> if it exists, even without -std=c23Tavian Barnes2024-05-291-3/+3
| | | | glibc added an implementation in 2.39.
* bit: Update to match C23Tavian Barnes2024-05-291-51/+45
| | | | | | | | | | Based on the latest C23 draft (N3220): - Argument types to generic bit functions should be unsigned - Bit functions return unsigned int - Byte-swapping functions (stdc_memreverse8*()) weren't added - stdc_rotate_{left,right}() weren't added - first_leading_*() counts from the *left*
* Rename config.h to prelude.hTavian Barnes2024-04-191-1/+1
|
* bit: Check __BYTE_ORDER__ for the native endianTavian Barnes2024-03-211-2/+2
| | | | __ORDER_NATIVE_ENDIAN__ is not a thing.
* bit: Rename bswap{16,32,64}()Tavian Barnes2024-01-031-16/+16
| | | | | NetBSD already defines this in <sys/bswap.h>, so pick names that don't conflict.
* bit: Implement a branchless has_single_bit()Tavian Barnes2023-11-131-1/+2
|
* Revert "bit: Implement a branchless has_single_bit()"Tavian Barnes2023-11-111-2/+1
| | | | | | Doesn't work for the highest bit due to overflow. This reverts commit 208376ef99da243545efcd6fb02d3469b4c068ed.
* bit: Implement a branchless has_single_bit()Tavian Barnes2023-11-101-1/+2
|
* config: Add constants for C standard versionsTavian Barnes2023-11-101-4/+4
|
* bit: Fix UINTPTR_WIDTH typoTavian Barnes2023-09-261-1/+1
|
* bit: Use predefined __*_WIDTH__ macros if we canTavian Barnes2023-09-261-24/+69
|
* bit: Add a cast to squelch -Wsign-compareTavian Barnes2023-07-241-1/+1
| | | | I see this only with musl-gcc for some reason.
* bit: Rename int.h to bit.hTavian Barnes2023-05-181-0/+355