No description
  • C 96.5%
  • Makefile 3.5%
Find a file
Juhani Krekelä 33979e7d93 Get rid of casts and signed integer right shifts in runtime code
Unsigned to signed cast is implementation defined (though in practice it
has the expected 2's complement semantics on essentially every relevant
platform). However, the only reason we used one in the first place was
to take advantage of arithmetic right shift broadcasting the sign bit to
the full length of a 32-bit integer. This requires right shift of
negative numbers to be defined as arithmetic – in C it is instead UB.

The remaining unsigned-to-unsigned casts would have been all defined,
but it is easier to keep the codebase UB-free by just banning all direct
casts. Since we do want to convert between 32-bit and 64-bit integers,
introduce meri_casts.h as a way to make the intent clear and warn on any
extra unintended implicit casts at the callsite.
2026-05-23 19:16:43 +02:00
.gitignore Add GNUMakefile for *nix platforms 2025-08-20 00:31:59 +03:00
Makefile Use rm -f in make clean 2026-05-21 14:06:05 +02:00
Makefile.common Get rid of casts and signed integer right shifts in runtime code 2026-05-23 19:16:43 +02:00
Makefile.win Rename Makefile to Makefile.win 2026-05-21 13:40:26 +02:00
meri_bigint.c Get rid of casts and signed integer right shifts in runtime code 2026-05-23 19:16:43 +02:00
meri_bigint.h Get rid of casts and signed integer right shifts in runtime code 2026-05-23 19:16:43 +02:00
meri_casts.h Get rid of casts and signed integer right shifts in runtime code 2026-05-23 19:16:43 +02:00
meri_object.c Include the correct header for UINT_MAX 2025-08-20 00:25:22 +03:00
meri_object.h Split components of the runtime into their own files 2025-08-18 17:00:18 +03:00
test_bigint.c Get rid of casts and signed integer right shifts in runtime code 2026-05-23 19:16:43 +02:00
tests.c Cast to (void *) for %p format specifier 2025-08-19 21:38:08 +00:00
tests.h Add tests 2025-08-19 23:56:45 +03:00