Per the SWIG Documentation (21.9.1 Default primitive type mappings), the C uint8_t is mapped to a Java short which is 16 bits and the C uint_15_t is mapped to a Java int which is 32 bits. I believe the C functions are 8 and 16 bits respectively, why does SWIG double the number of bits when wrapping in Java?
Per the SWIG Documentation (21.9.1 Default primitive type mappings), the C uint8_t is mapped
Share
The problem is that Java types are always signed.
Thus if you have an unsigned C type that goes from 0 to 255, the smallest Java type that can represent the upper half of that range is a short.
The alternative is that you shift or somehow transform your
uint8_tto use the negative parts of Java’sbyte, but the semantics of that are very counterintuitive.