kaitai-io / kaitai_struct

Kaitai Struct: declarative language to generate binary data parsers in C++ / C# / Go / Java / JavaScript / Lua / Nim / Perl / PHP / Python / Ruby
https://kaitai.io
4.03k stars 198 forks source link

ksc: out of range enums #92

Open koczkatamas opened 7 years ago

koczkatamas commented 7 years ago

C# and Java (possibly others) are using s4 enums, but the compiler generates u4 enums which are out-of-range if values above 2**31 used.

In C# we can choose the underlying type for enums by using public enum LoadCommandType: uint instead of public enum LoadCommandType.

Affected formats: Mach-O, ...

GreyCat commented 7 years ago

I guess we can either generate signed enum values for Java? Would that help?