Add big-endian ints#83
Conversation
There was a problem hiding this comment.
whenever I will see int8be in syscall description, I will say s/int8be/int8/
int8be is confusing, drop it
There was a problem hiding this comment.
drop it along with int8be
There was a problem hiding this comment.
Let's give proper size to all types, including syscall arguments.
I don't see why int32be should be prohibited in syscall aguments, but allowed everywhere else. Moreover, syscall arguments do have size -- they are intptr's effectively. Sysgen already makes assumptions about intptr size in sz := int64(64) // TODO: assume that pointer is 8 bytes for now. Add const ptrSize = 8 to sysgen.go and use to give size to all types where size is 0 currently.
There was a problem hiding this comment.
lookupConst := ...
and drop the previous line
You may have seen this form with separate declaration and initialization in sys/prog, but it is necessary only when you have recursion (lookupConst would need to call lookupConst). Otherwise you just do f := func(.....
There was a problem hiding this comment.
Please let's do just 'BigEndian bool'.
This Endianness Endianness causes too much clutter for no apparent benefit. There are only 2 options, which is naturally represented by a bool. There are multiple copies
Endianness: LittleEndian,
Endianness == LittleEndian
endianness := "LittleEndian"
if !littleEndian {
endianness = "BigEndian"
}
If we do the bool, we can drop:
endianness := "LittleEndian"
if !littleEndian {
endianness = "BigEndian"
}
entirely, as a bool is correctly printed with %v.
We can also drop Endianness: LittleEndian, initialization, as default value for bool represents our semantic default of having little endian (unless said otherwise).
|
PTAL |
dvyukov
left a comment
There was a problem hiding this comment.
Much nicer now. Thanks!
One small nit.
There was a problem hiding this comment.
s/value uintptr, size uintptr/value, size uintptr/
|
PTAL |
|
LGTM |
No description provided.