Generate unsigned integers declarations, mostly without implementations
Generate and/or/xor/inv for UByte/UShort using experimental signed counterparts
This commit is contained in:
@@ -36,6 +36,16 @@ enum class PrimitiveType {
|
||||
}
|
||||
}
|
||||
|
||||
enum class UnsignedType {
|
||||
UBYTE,
|
||||
USHORT,
|
||||
UINT,
|
||||
ULONG;
|
||||
|
||||
val capitalized: String get() = name.substring(0, 2) + name.substring(2).toLowerCase()
|
||||
val asSigned: PrimitiveType = PrimitiveType.valueOf(name.substring(1))
|
||||
}
|
||||
|
||||
enum class ProgressionKind {
|
||||
CHAR,
|
||||
INT,
|
||||
@@ -53,3 +63,4 @@ fun areEqualNumbers(v: String) = "$v == other.$v"
|
||||
|
||||
fun hashLong(v: String) = "($v xor ($v ushr 32))"
|
||||
|
||||
fun convert(v: String, from: UnsignedType, to: UnsignedType) = if (from == to) v else "$v.to${to.capitalized}()"
|
||||
Reference in New Issue
Block a user