From f6446228fbfc52c39fbb9da17dab19ee34b05c6c Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Tue, 29 Aug 2017 09:26:29 -0400 Subject: [PATCH] Delete BufferElement.cs --- EMU7800/Core/BufferElement.cs | 71 ----------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 EMU7800/Core/BufferElement.cs diff --git a/EMU7800/Core/BufferElement.cs b/EMU7800/Core/BufferElement.cs deleted file mode 100644 index c339eacc7a..0000000000 --- a/EMU7800/Core/BufferElement.cs +++ /dev/null @@ -1,71 +0,0 @@ -namespace EMU7800.Core -{ - /* - * why this sucks: - * A read costs 3 shifts and an or. A write costs 2 shifts. Additional shifts are - * needed elsewhere to figure out which item in a BufferElement[] to access. Because - * the encapsulation is for a BufferElement and not a whole array of them, code elsewhere - * is gunked up with 'BufferElement.SIZE' shifts. If the 32 bit "alias" was actually used, - * there might be some purpose to this code: but it's only used for a ZeroMemory() - * replacement. Every use of BufferElement in the code is a BufferElement[] used as a gunked - * up replacement for a byte[]. - * - * A small speed increase was observed hacking this out; but my motivation was more about cleaness - * and stomping out bad ideas. - */ - - /* - /// - /// Frames are composed of s, - /// that group bytes into machine words for efficient array processing. - /// Bytes are packed in logical little endian order. - /// - public struct BufferElement - { - /// - /// The number of bytes contained within a . - /// - public const int SIZE = 4; // 2^SHIFT - - /// - /// The mask value applied against a byte array index to access the individual bytes within a . - /// - public const int MASK = 3; // SIZE - 1 - - /// - /// The left shift value to convert a byte array index to a array index. - /// - public const int SHIFT = 2; - - uint _data; - - /// - /// A convenience accessor for reading/writing individual bytes within this . - /// - /// - public byte this[int offset] - { - get - { - var i = (offset & MASK) << 3; - return (byte)(_data >> i); - } - set - { - var i = (offset & MASK) << 3; - var d = (uint)value << i; - var di = (uint)0xff << i; - _data = _data & ~di | d; - } - } - - /// - /// Zeros out all bytes of this . - /// - public void ClearAll() - { - _data = 0; - } - } - */ -}