diff options
Diffstat (limited to 'undo.cpp')
-rw-r--r-- | undo.cpp | 48 |
1 files changed, 1 insertions, 47 deletions
@@ -1,49 +1,3 @@ -void Arbitrary_WriteInto(uint8 *Address_Read, uint8 *Address_Write, uint64 Size) -{ - uint64 i = 0; - while (i < Size) { - *(Address_Write + i) = *(Address_Read + i); - i++; - } -} - -void Arbitrary_Zero(uint8 *Address_Write, uint64 Size) -{ - uint64 i = 0; - while (i < Size) { - *(Address_Write + i) = 0; - i++; - } -} - -void Arbitrary_SwapData(memory *Memory, uint8 *Address_0, uint8 *Address_1, uint64 Size) -{ - uint8 *Buffer_Scratch = (uint8 *)Memory_PushScratch(Memory, Size); - Arbitrary_WriteInto(Address_0, Buffer_Scratch, Size); - Arbitrary_WriteInto(Address_1, Address_0, Size); - Arbitrary_WriteInto(Buffer_Scratch, Address_1, Size); - Memory_PopScratch(Memory, Size); -} - - -static void -Arbitrary_ShiftData(uint8 *Address_Start, uint8 *Address_End, uint64 ShiftAmount, int32 Direction) -{ - if (Direction > 0) { - uint8 *AddressPlayhead = Address_End; - while ((ptrsize)AddressPlayhead >= (ptrsize)Address_Start) { - *(AddressPlayhead + ShiftAmount) = *AddressPlayhead; - AddressPlayhead--; - } - } else { - uint8 *AddressPlayhead = Address_Start; - while ((ptrsize)AddressPlayhead < (ptrsize)Address_End) { - *(AddressPlayhead - ShiftAmount) = *AddressPlayhead; - AddressPlayhead++; - } - } -} - struct history_info { uint16 ActionCount_Total; uint16 ActionCount_EndOfPlayhead; @@ -249,7 +203,7 @@ static void History_Action_Add(memory *Memory, history_action ActionData, void * { void *Address_HistoryTree = Memory_AddressAtOffset(Memory, P_UndoBuffer, Info.ActionOffset_Total); void *Address_Data = Memory_AddressAtOffset(Memory, Action->TableName, Action->ByteOffset); - Arbitrary_WriteInto((uint8 *)Address_Data, (uint8 *)Address_HistoryTree, Action->Size); + Memory_Copy((uint8 *)Address_HistoryTree, (uint8 *)Address_Data, Action->Size); } else if (Action->Type == action_type_shift) { void *Address_Start = Memory_AddressAtOffset(Memory, Action->TableName, Action->ByteOffset); |