morganstanley / hobbes

A language and an embedded JIT compiler
http://hobbes.readthedocs.io/
Apache License 2.0
1.16k stars 105 forks source link

add partial support for int128 #444

Closed mo-xiaoming closed 1 year ago

mo-xiaoming commented 1 year ago

For the moment, hobbes doesn't handle int128 type well if the value is not within the range of int64

> 9223372036854775808H         # int64::max + 1
-9223372036854775808
> -9223372036854775809H        # int64::min - 1
9223372036854775807

After this change, int128 still won't work with int128::min because parser rewrites negative number to a neg function call. For example, -3 -> neg(3). However, for any integral types, abs(min) overflows. This issue will be addressed in a different PR