Skip to content

Commit

Permalink
make it super fast
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenretriverYT committed Jan 31, 2024
1 parent ec7a4aa commit 0050e46
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion source/Cosmos.HAL2/BlockDevice/ATAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,23 @@ public override void ReadBlock(ulong SectorNum, ulong SectorCount, ref byte[] aD

//Convert the buffer into bytes
byte[] array = new byte[SectorSize];
int counter = 0;
/*int counter = 0;
for (int i = 0; i < SectorSize / 2; i++)
{
var item = buffer[i];
var bytes = BitConverter.GetBytes(item);
array[counter++] = bytes[0];
array[counter++] = bytes[1];
}*/

unsafe {
fixed (byte* ptr = array) {
fixed (ushort* ptr2 = buffer) {
byte* ptr3 = (byte*)ptr2;
MemoryOperations.Copy(ptr, ptr3, SectorSize);
}
}
}

//Return
Expand Down

0 comments on commit 0050e46

Please sign in to comment.