mirror of
https://github.com/ruby/ruby.git
synced 2026-01-28 04:54:23 +00:00
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);
| ^~~~~~~~~~~~~~~~~
This commit is contained in:
parent
66bda73190
commit
55ea3ec00f
Notes:
git
2025-12-08 23:01:33 +00:00
@ -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);
|
||||
|
||||
@ -1928,11 +1928,6 @@ ruby_swap128_uint(rb_uint128_t x)
|
||||
return result;
|
||||
}
|
||||
|
||||
union uint128_int128_conversion {
|
||||
rb_uint128_t uint128;
|
||||
rb_int128_t int128;
|
||||
};
|
||||
|
||||
static inline rb_int128_t
|
||||
ruby_swap128_int(rb_int128_t x)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user