diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2025-12-07 12:43:44 -0500 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2025-12-08 15:01:05 -0800 |
| commit | 55ea3ec00f5166423cd7dcd67e220cd264a766f6 (patch) | |
| tree | 8fe29d8d55e2c6938bc1f0f5680796354d820cbb /internal | |
| parent | 66bda731901d4588c9df1a671022231ea0d03216 (diff) | |
Fix strict aliasing warning in rb_int128_to_numeric
If we don't have uint128, then rb_int128_to_numeric emits a strict
aliasing warning:
numeric.c:3641:39: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
3641 | return rb_uint128_to_numeric(*(rb_uint128_t*)&n);
| ^~~~~~~~~~~~~~~~~
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/numeric.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/numeric.h b/internal/numeric.h index 75181a7f16..d3905f048c 100644 --- a/internal/numeric.h +++ b/internal/numeric.h @@ -164,6 +164,11 @@ union rb_int128 { }; typedef union rb_int128 rb_int128_t; +union uint128_int128_conversion { + rb_uint128_t uint128; + rb_int128_t int128; +}; + // Conversion functions for 128-bit integers: rb_uint128_t rb_numeric_to_uint128(VALUE x); rb_int128_t rb_numeric_to_int128(VALUE x); |
