zeichensystem
c3bf549fad
Add README and LICENSE
2025-12-21 20:55:04 +01:00
zeichensystem
2f50db1858
Fix more GCC warnings
2025-12-21 19:51:42 +01:00
zeichensystem
a964466c8b
Fix GCC errors
2025-12-21 18:17:22 +01:00
zeichensystem
45f07986c3
Add string functions
2025-12-21 17:30:13 +01:00
jun
ae83ee66e1
Make guf_utf8_char 4 bytes instead of 5
...
(Null-termination was superfluous here.)
2025-05-25 16:04:26 +02:00
jun
c54fc75221
Use least vs fast int types
2025-05-19 09:50:05 +02:00
jun
2355feaa70
Use portable guf_math_ckdint functions in guf_rand
2025-05-19 00:48:38 +02:00
jun
096b83638b
Fix guf_id_pool integer portability
2025-05-19 00:42:27 +02:00
jun
4217ef6e0b
Fix guf_str uninit
2025-05-19 00:12:27 +02:00
jun
57f0e47efc
Refactor to use portable minimum-width integers.
...
The signed and unsigned fixed-width integers (int32_t, uint32_t etc.) are optional
in C99 (and above). Use the non-optional minimum-width integers (int_fast32_t, uint_fast32_t and int_least32_t, uint_least32_t etc.) instead.
To simulate unsigned wrap-around, use the GUF_UWRAP macros in guf_common.h
cf. https://en.cppreference.com/w/c/types/integer (last-retrieved: 2025-05-18)
2025-05-18 22:03:03 +02:00
jun
7ec2af0c33
Add unsigned integer wrapping functions
2025-05-16 13:44:27 +02:00
jun
8b78803ad8
Add more dbuf_str tests
2025-05-16 10:12:04 +02:00
jun
614a9716cc
Fix failed assertion in guf_str_copy
...
An assertion GUF_ASSERT(str_is_valid(dst)) failed in guf_str_copy when it called guf_str_cstr(dst)
since guf_str_cstr assumes an already valid string, which was not the case when src was a short string.
Therefore, we get the dst's c_str now without calling guf_str_cstr(dst)
(Found by writing DbufStrTest.)
2025-05-15 20:53:50 +02:00
jun
7585848ac9
Prevent more potential int promotion bugs
2025-05-15 13:24:29 +02:00
jun
9b64b22806
Make signed guf_wrapping_mul more general
...
Don't fail on mod == 0 (in weird cases where the given UNSIGNED_TYPE_MAX == SIGNED_TYPE_MAX)
but
res = mod > 0 ? (1u * res % mod) : res;
2025-05-15 09:21:30 +02:00
jun
466982ffcb
Use better terminology for overflow and integer 'underflow'
2025-05-15 09:11:31 +02:00
jun
ec074d5753
Fix potential int-promotion bugs in ckdint
...
Expressions like
(uin16_t)a * (uint16_t)b * (uint16_t)c
might be promoted to (signed) int (in that example, on platforms where sizeof(int) > sizeof(uint16_t)),
and therefore lead to undefined behaviour on overflow.
The above expression can be fixed as
1u * (uint16_t)a * (uint16_t)b * (uint16_t)c
(The 1u makes sure a, b, and c would be promoted to unsigned int (instead of int) on platforms where sizeof(int) > sizeof(uint16_t))
cf. https://stackoverflow.com/questions/27001604/32-bit-unsigned-multiply-on-64-bit-causing-undefined-behavior
2025-05-15 08:46:54 +02:00
jun
b99434a611
Change C/CXX flags
2025-05-14 18:07:41 +02:00
jun
562dcc532d
Refactor test
2025-05-14 17:37:19 +02:00
jun
776c4a8899
Add static/non-static option for guf_alloc_libc.h
2025-05-14 17:31:24 +02:00
jun
894d9e8fc4
Add name to alloc_tracker
2025-05-14 17:08:15 +02:00
jun
37f9011166
Add guf_alloc_tracker
2025-05-14 14:47:20 +02:00
jun
6ffb79f7a0
Fix implementation defined behaviour in guf_wrapping_mul
2025-05-14 08:51:41 +02:00
jun
1dba7661e6
Add math_ckdint tests
2025-05-13 21:14:20 +02:00
jun
c4f3616b23
Refactor tests
2025-05-13 17:36:08 +02:00
jun
6091eac820
Add guf_math_ckdint IMPL_STATIC etc.
2025-05-13 14:56:21 +02:00
jun
873cdf20b1
Add checked mul arithmetic
2025-05-13 12:45:17 +02:00
jun
9c417d2aa1
Add checked arithmetic
2025-05-11 08:55:03 +02:00
jun
c4b68d5ad2
Add guf_tok test
2025-05-09 15:43:52 +02:00
jun
864bd70ece
Add more guf_str tests
2025-05-08 20:38:25 +02:00
jun
1013616b2d
Re-implement guf_str tokeniser
2025-05-02 21:54:39 +02:00
jun
c6b0aa8d89
Add guf_str hash functions
2025-04-24 02:55:39 +02:00
jun
e98dc3b91e
Fix guf_str bugs and add tests
2025-04-24 01:43:24 +02:00
jun
0910ee4bd8
Minor guf_id_pool changes
2025-04-09 06:27:35 +02:00
jun
f3e184da73
Fix guf_dict_init_with_capacity kv_idx_cap calculation
2025-03-29 17:32:13 +01:00
jun
ae7814fe7c
Comment guf_rand
2025-03-29 16:16:06 +01:00
jun
d062784425
Add separate 32/64 bit versions to guf_rand
2025-03-29 01:55:32 +01:00
jun
05f995e855
Add guf_rand_splitmix32
2025-03-28 22:09:15 +01:00
jun
461006746e
Add guf_str_substr
2025-03-28 20:26:43 +01:00
jun
9e0cd79ca0
Add guf_dict_shrink_capacity
2025-03-28 18:32:07 +01:00
jun
3ff4cd7572
Add more dict functions
2025-03-21 18:57:22 +01:00
jun
3ee07078f0
Add comments
2025-03-21 00:51:29 +01:00
jun
7630ecfdcf
Change directory structure
2025-03-21 00:22:34 +01:00
jun
275f46226d
Add more guf_str functions
2025-03-20 23:30:45 +01:00
jun
21d1b04e6b
Add changeable load factor
2025-03-20 20:29:21 +01:00
jun
534ff261ca
Add move- and copy ctors to dict and guf_str
2025-03-20 15:29:18 +01:00
jun
c039e24996
Use SIZE_MAX instead of SIZE_T_MAX
2025-03-19 23:03:10 +01:00
jun
29014f4c52
Fix dict asserts
2025-03-19 19:16:31 +01:00
jun
48b366d8e9
Fix warnings in release
2025-03-19 18:29:52 +01:00
jun
7e1bbc769e
Replace puts with fputs in guf_err_to_str
2025-03-19 18:14:06 +01:00