Skip to content

Add Optional 128-bit Integer Support to C++ Runtime#239

Open
AaronWebster wants to merge 7 commits into
masterfrom
int128-runtime-support
Open

Add Optional 128-bit Integer Support to C++ Runtime#239
AaronWebster wants to merge 7 commits into
masterfrom
int128-runtime-support

Conversation

@AaronWebster
Copy link
Copy Markdown
Collaborator

This pull request introduces support for 128-bit integers in the C++ runtime, enabling the handling of types larger than 64 bits (up to 128 bits) when the environment supports it, specifically gcc's __uint128_t and __int128_t.

AaronWebster and others added 4 commits December 3, 2025 13:27
- Update prelude.emb to allow UInt and Int sizes up to 128 bits
  (previously limited to 64 bits). Added documentation noting that
  128-bit support requires platform support (__uint128_t/__int128_t).

- Update constraints_test.py to test with sizes > 128 bits now that
  128-bit fields are valid.

- Add comprehensive unit tests for 128-bit integer support:
  - emboss_bit_util_test.cc: ByteSwap, MaskToNBits, IsPowerOfTwo tests
  - emboss_memory_util_test.cc: MemoryAccessor, BitBlock tests for
    128-bit values including non-full-width (72, 96 bits) and
    cross-64-bit-boundary operations
  - emboss_prelude_test.cc: UIntView and IntView tests for 128-bit
    read/write, sign extension, and CouldWriteValue

- Add int128_sizes_test.cc integration test for generated code with
  128-bit integer fields (UInt128Sizes, Int128Sizes, big-endian
  variants, and arrays).

- Update int128_sizes.emb documentation and remove AnonymousBits128
  struct (128-bit bits types require separate implementation work).
@AaronWebster AaronWebster self-assigned this Jan 29, 2026
@AaronWebster AaronWebster added the enhancement New feature or request label Jan 29, 2026
Comment thread runtime/cpp/emboss_defines.h
Comment thread runtime/cpp/emboss_defines.h
Comment thread runtime/cpp/emboss_cpp_types.h
Comment thread compiler/back_end/cpp/testcode/int128_sizes_test.cc Outdated
Comment thread testdata/__init__.py
Comment thread testdata/int128_sizes.emb Outdated
- Add EMBOSS_INT128_T and EMBOSS_UINT128_T macros for extensibility.
- Change include path in emboss_cpp_types.h to relative.
- Update copyright years to 2026 in testcode and .emb files.
- Restore testdata/__init__.py copyright header.
- Revert unrelated whitespace change.
@AaronWebster
Copy link
Copy Markdown
Collaborator Author

@jasongraffius Ready for another look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants