mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
Changed implementation of Serialize::EmitDiffPtrID and
Deserialize::ReadDiffPtrID to read and emit bools instead of unsigned integers. This should result in a nice space optimization once we have "auto-abbreviation" generation in place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44200 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -141,8 +141,8 @@ public:
|
|||||||
SerializedPtrID ReadPtrID() { return (SerializedPtrID) ReadInt(); }
|
SerializedPtrID ReadPtrID() { return (SerializedPtrID) ReadInt(); }
|
||||||
|
|
||||||
SerializedPtrID ReadDiffPtrID(SerializedPtrID& PrevID) {
|
SerializedPtrID ReadDiffPtrID(SerializedPtrID& PrevID) {
|
||||||
unsigned x = ReadInt();
|
bool x = ReadBool();
|
||||||
return (SerializedPtrID) (x ? (PrevID+x) : 0);
|
return (SerializedPtrID) (x ? (PrevID+1) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,10 +57,11 @@ public:
|
|||||||
SerializedPtrID ptr_id = getPtrId(ptr);
|
SerializedPtrID ptr_id = getPtrId(ptr);
|
||||||
|
|
||||||
if (ptr_id == 0)
|
if (ptr_id == 0)
|
||||||
EmitInt(0);
|
EmitBool(false);
|
||||||
else {
|
else {
|
||||||
assert (ptr_id > PrevID);
|
assert (ptr_id > PrevID);
|
||||||
EmitInt(ptr_id-PrevID);
|
assert (PrevID == 0 || ptr_id - PrevID == 1);
|
||||||
|
EmitBool(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ptr_id;
|
return ptr_id;
|
||||||
|
Reference in New Issue
Block a user