Unsigned variables in Scala

后端 未结 2 692
逝去的感伤
逝去的感伤 2021-02-07 07:01

I am converting some C code to Scala as we are moving (allegedly) into the Modern world here in Corporate towers, or so I have been told anyways.

Some of the C code uses

2条回答
  •  梦谈多话
    2021-02-07 07:46

    The JVM unfortunately does not support unsigned data types (besides char, thanks Erwin), but there is hope! Scala has a sufficiently advanced type system that allows you to create your own types that act like unsigned types!

    There is even a library that already does it! The library overloads the operators and provides conversions.

提交回复
热议问题