Totem-Studios / lotus

Lotus is a type-safe compiled programming languages designed to simplify systems programming, achieving memory safety using RAII.
https://totemstudios.org/lotus
MIT License
4 stars 2 forks source link

The 128 bit integer type (i128) is not implemented [FEATURE REQUEST] #34

Open lucasnorman07 opened 3 months ago

lucasnorman07 commented 3 months ago

Is your feature request related to a problem? Please describe.

There is currently no way to store integers greater than the ones that fit inside of an i64 even though LLVM supports integers up to i128.

Describe the solution you'd like

A way to parse and generate LLVM IR for integers that have a bit width of 128 (i128).

Describe alternatives you've considered

One way would be to use a library that supports integers bigger than "unsigned long long" in C++. Another way would be to store the integers as strings, and then create a function to compare the string integer to other string integers, to find the bit width of the string and then generate an i128 in LLVM using llvm::APInt. llvm::APInt has a constructor that takes in a string, although it still needs the bit width as an argument.

Additional context

The challenge with implementing i128 is that C++ does not provide a way to store integers that have a bit width of 128.