mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 05:01:24 +00:00
[gamecode] Tidy up shiftops a little
The various indices were a little inconsistent making modifications tricky. I discovered that signed left-shifts are considered UB if the value overflows the non-sign bits (but unsigned left shifts are fine), and signed right shifts are implementation dependent. Whee. However, it's likely that signed right shifts can be relied upon, at least well enough for unit tests. I imagine signed left, too, but I plan on converting them to unsigned. Also, negative shift values are UB, but that's less of a worry, but also needs "fixing" (ie, make unsigned). However, later.
This commit is contained in:
parent
7c56c10d25
commit
5c822f6579
1 changed files with 9 additions and 6 deletions
|
@ -488,19 +488,22 @@ scale_formats = {
|
|||
},
|
||||
}
|
||||
shiftops_formats = {
|
||||
"opcode": "OP_{mn_shift[u*2+r].upper()}_{shift_type[u*2+t]}_{ss+1}",
|
||||
"mnemonic": "{mn_shift[u*2+r]}.{shift_type[u*2+t]}",
|
||||
"opcode": "OP_{mn_shift[u*2+r].upper()}_{shift_type[t][u*2+r]}_{ss+1}",
|
||||
"mnemonic": "{mn_shift[u*2+r]}.{shift_type[t][u*2+r]}",
|
||||
"opname": "{op_shift[u*2+r]}",
|
||||
"widths": "{ss+1}, {ss+1}, {ss+1}",
|
||||
"columns": "1, 1, 1",
|
||||
"types": "{shift_types[t][u]}, {shift_types[t][0]}, {shift_types[t][u]}",
|
||||
"types": "{shift_types[t][u*2+r]}, {shift_types[t][0]}, {shift_types[t][u*2+r]}",
|
||||
"args": {
|
||||
"mn_shift": ["shl", "asr", "shl", "shr"],
|
||||
"op_shift": ["shl", "shr", "shl", "shr"],
|
||||
"shift_type": ['I', 'L', 'u', 'U'],
|
||||
"shift_type": [
|
||||
['I', 'I', 'u', 'u'],
|
||||
['L', 'L', 'U', 'U'],
|
||||
],
|
||||
"shift_types": [
|
||||
["ev_int", "ev_uint"],
|
||||
["ev_long", "ev_ulong"],
|
||||
["ev_int", "ev_int", "ev_uint", "ev_uint"],
|
||||
["ev_long", "ev_long", "ev_ulong", "ev_ulong"],
|
||||
],
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue