[Refactor] Use collection expressions.

This commit is contained in:
2024-05-01 04:39:38 +01:00
parent f7ca79b09e
commit 134ce7041e
667 changed files with 12936 additions and 13750 deletions

View File

@@ -159,7 +159,7 @@ public sealed partial class Symbian
if(_compressed)
{
if(_files[entryNumber].originalLength == 0)
stream = new MemoryStream(Array.Empty<byte>());
stream = new MemoryStream([]);
else
{
stream = new ForcedSeekStream<ZLibStream>(_files[entryNumber].originalLength,

View File

@@ -305,13 +305,13 @@ public sealed partial class Symbian
// description.AppendFormat("{0} = {1}", kvp.Key, kvp.Value).AppendLine();
// Set instance values
_files = new List<DecodedFileRecord>();
_conditions = new List<string>();
_files = [];
_conditions = [];
uint currentFile = 0;
offset = sh.files_ptr;
var conditionLevel = 0;
_options = new List<OptionRecord>();
_options = [];
// Get only the options records
do

View File

@@ -125,9 +125,9 @@ public sealed partial class Symbian
br.BaseStream.Seek(sh.lang_ptr, SeekOrigin.Begin);
for(var i = 0; i < sh.languages; i++) languages.Add(((LanguageCodes)br.ReadUInt16()).ToString("G"));
_files = new List<DecodedFileRecord>();
_conditions = new List<string>();
_options = new List<OptionRecord>();
_files = [];
_conditions = [];
_options = [];
uint currentFile = 0;
uint offset = sh.files_ptr;
@@ -152,7 +152,7 @@ public sealed partial class Symbian
// Files appear on .sis in the reverse order they should be processed
_files.Reverse();
List<DecodedFileRecord> filesWithFixedFilenames = new();
List<DecodedFileRecord> filesWithFixedFilenames = [];
foreach(DecodedFileRecord f in _files)
{

View File

@@ -49,7 +49,7 @@ public sealed partial class Symbian
if(entryNumber < 0 || entryNumber >= _files.Count) return ErrorNumber.OutOfRange;
xattrs = new List<string>();
xattrs = [];
if(_files[entryNumber].mime is not null) xattrs.Add("org.iana.mime_type");

View File

@@ -45,9 +45,8 @@ public sealed class CRC16CcittContext : Crc16Context
/// <summary>CCITT CRC16 seed</summary>
public const ushort CRC16_CCITT_SEED = 0x0000;
static readonly ushort[][] _ccittCrc16Table =
{
new ushort[]
{
[
[
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C,
0xD1AD, 0xE1CE, 0xF1EF, 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, 0x9339, 0x8318,
0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4,
@@ -68,9 +67,8 @@ public sealed class CRC16CcittContext : Crc16Context
0x1AD0, 0x2AB3, 0x3A92, 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9, 0x7C26, 0x6C07,
0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1, 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9,
0x9FF8, 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
},
new ushort[]
{
],
[
0x0000, 0x3331, 0x6662, 0x5553, 0xCCC4, 0xFFF5, 0xAAA6, 0x9997, 0x89A9, 0xBA98, 0xEFCB, 0xDCFA, 0x456D,
0x765C, 0x230F, 0x103E, 0x0373, 0x3042, 0x6511, 0x5620, 0xCFB7, 0xFC86, 0xA9D5, 0x9AE4, 0x8ADA, 0xB9EB,
0xECB8, 0xDF89, 0x461E, 0x752F, 0x207C, 0x134D, 0x06E6, 0x35D7, 0x6084, 0x53B5, 0xCA22, 0xF913, 0xAC40,
@@ -91,9 +89,8 @@ public sealed class CRC16CcittContext : Crc16Context
0x637B, 0x3628, 0x0519, 0x10B2, 0x2383, 0x76D0, 0x45E1, 0xDC76, 0xEF47, 0xBA14, 0x8925, 0x991B, 0xAA2A,
0xFF79, 0xCC48, 0x55DF, 0x66EE, 0x33BD, 0x008C, 0x13C1, 0x20F0, 0x75A3, 0x4692, 0xDF05, 0xEC34, 0xB967,
0x8A56, 0x9A68, 0xA959, 0xFC0A, 0xCF3B, 0x56AC, 0x659D, 0x30CE, 0x03FF
},
new ushort[]
{
],
[
0x0000, 0x3730, 0x6E60, 0x5950, 0xDCC0, 0xEBF0, 0xB2A0, 0x8590, 0xA9A1, 0x9E91, 0xC7C1, 0xF0F1, 0x7561,
0x4251, 0x1B01, 0x2C31, 0x4363, 0x7453, 0x2D03, 0x1A33, 0x9FA3, 0xA893, 0xF1C3, 0xC6F3, 0xEAC2, 0xDDF2,
0x84A2, 0xB392, 0x3602, 0x0132, 0x5862, 0x6F52, 0x86C6, 0xB1F6, 0xE8A6, 0xDF96, 0x5A06, 0x6D36, 0x3466,
@@ -114,9 +111,8 @@ public sealed class CRC16CcittContext : Crc16Context
0x27C5, 0x7E95, 0x49A5, 0xA031, 0x9701, 0xCE51, 0xF961, 0x7CF1, 0x4BC1, 0x1291, 0x25A1, 0x0990, 0x3EA0,
0x67F0, 0x50C0, 0xD550, 0xE260, 0xBB30, 0x8C00, 0xE352, 0xD462, 0x8D32, 0xBA02, 0x3F92, 0x08A2, 0x51F2,
0x66C2, 0x4AF3, 0x7DC3, 0x2493, 0x13A3, 0x9633, 0xA103, 0xF853, 0xCF63
},
new ushort[]
{
],
[
0x0000, 0x76B4, 0xED68, 0x9BDC, 0xCAF1, 0xBC45, 0x2799, 0x512D, 0x85C3, 0xF377, 0x68AB, 0x1E1F, 0x4F32,
0x3986, 0xA25A, 0xD4EE, 0x1BA7, 0x6D13, 0xF6CF, 0x807B, 0xD156, 0xA7E2, 0x3C3E, 0x4A8A, 0x9E64, 0xE8D0,
0x730C, 0x05B8, 0x5495, 0x2221, 0xB9FD, 0xCF49, 0x374E, 0x41FA, 0xDA26, 0xAC92, 0xFDBF, 0x8B0B, 0x10D7,
@@ -137,9 +133,8 @@ public sealed class CRC16CcittContext : Crc16Context
0x9185, 0x0A59, 0x7CED, 0x84EA, 0xF25E, 0x6982, 0x1F36, 0x4E1B, 0x38AF, 0xA373, 0xD5C7, 0x0129, 0x779D,
0xEC41, 0x9AF5, 0xCBD8, 0xBD6C, 0x26B0, 0x5004, 0x9F4D, 0xE9F9, 0x7225, 0x0491, 0x55BC, 0x2308, 0xB8D4,
0xCE60, 0x1A8E, 0x6C3A, 0xF7E6, 0x8152, 0xD07F, 0xA6CB, 0x3D17, 0x4BA3
},
new ushort[]
{
],
[
0x0000, 0xAA51, 0x4483, 0xEED2, 0x8906, 0x2357, 0xCD85, 0x67D4, 0x022D, 0xA87C, 0x46AE, 0xECFF, 0x8B2B,
0x217A, 0xCFA8, 0x65F9, 0x045A, 0xAE0B, 0x40D9, 0xEA88, 0x8D5C, 0x270D, 0xC9DF, 0x638E, 0x0677, 0xAC26,
0x42F4, 0xE8A5, 0x8F71, 0x2520, 0xCBF2, 0x61A3, 0x08B4, 0xA2E5, 0x4C37, 0xE666, 0x81B2, 0x2BE3, 0xC531,
@@ -160,9 +155,8 @@ public sealed class CRC16CcittContext : Crc16Context
0x1698, 0xF84A, 0x521B, 0x3B0C, 0x915D, 0x7F8F, 0xD5DE, 0xB20A, 0x185B, 0xF689, 0x5CD8, 0x3921, 0x9370,
0x7DA2, 0xD7F3, 0xB027, 0x1A76, 0xF4A4, 0x5EF5, 0x3F56, 0x9507, 0x7BD5, 0xD184, 0xB650, 0x1C01, 0xF2D3,
0x5882, 0x3D7B, 0x972A, 0x79F8, 0xD3A9, 0xB47D, 0x1E2C, 0xF0FE, 0x5AAF
},
new ushort[]
{
],
[
0x0000, 0x45A0, 0x8B40, 0xCEE0, 0x06A1, 0x4301, 0x8DE1, 0xC841, 0x0D42, 0x48E2, 0x8602, 0xC3A2, 0x0BE3,
0x4E43, 0x80A3, 0xC503, 0x1A84, 0x5F24, 0x91C4, 0xD464, 0x1C25, 0x5985, 0x9765, 0xD2C5, 0x17C6, 0x5266,
0x9C86, 0xD926, 0x1167, 0x54C7, 0x9A27, 0xDF87, 0x3508, 0x70A8, 0xBE48, 0xFBE8, 0x33A9, 0x7609, 0xB8E9,
@@ -183,9 +177,8 @@ public sealed class CRC16CcittContext : Crc16Context
0xEAF7, 0x2417, 0x61B7, 0x8B38, 0xCE98, 0x0078, 0x45D8, 0x8D99, 0xC839, 0x06D9, 0x4379, 0x867A, 0xC3DA,
0x0D3A, 0x489A, 0x80DB, 0xC57B, 0x0B9B, 0x4E3B, 0x91BC, 0xD41C, 0x1AFC, 0x5F5C, 0x971D, 0xD2BD, 0x1C5D,
0x59FD, 0x9CFE, 0xD95E, 0x17BE, 0x521E, 0x9A5F, 0xDFFF, 0x111F, 0x54BF
},
new ushort[]
{
],
[
0x0000, 0xB861, 0x60E3, 0xD882, 0xC1C6, 0x79A7, 0xA125, 0x1944, 0x93AD, 0x2BCC, 0xF34E, 0x4B2F, 0x526B,
0xEA0A, 0x3288, 0x8AE9, 0x377B, 0x8F1A, 0x5798, 0xEFF9, 0xF6BD, 0x4EDC, 0x965E, 0x2E3F, 0xA4D6, 0x1CB7,
0xC435, 0x7C54, 0x6510, 0xDD71, 0x05F3, 0xBD92, 0x6EF6, 0xD697, 0x0E15, 0xB674, 0xAF30, 0x1751, 0xCFD3,
@@ -206,9 +199,8 @@ public sealed class CRC16CcittContext : Crc16Context
0xAB64, 0x73E6, 0xCB87, 0x18E3, 0xA082, 0x7800, 0xC061, 0xD925, 0x6144, 0xB9C6, 0x01A7, 0x8B4E, 0x332F,
0xEBAD, 0x53CC, 0x4A88, 0xF2E9, 0x2A6B, 0x920A, 0x2F98, 0x97F9, 0x4F7B, 0xF71A, 0xEE5E, 0x563F, 0x8EBD,
0x36DC, 0xBC35, 0x0454, 0xDCD6, 0x64B7, 0x7DF3, 0xC592, 0x1D10, 0xA571
},
new ushort[]
{
],
[
0x0000, 0x47D3, 0x8FA6, 0xC875, 0x0F6D, 0x48BE, 0x80CB, 0xC718, 0x1EDA, 0x5909, 0x917C, 0xD6AF, 0x11B7,
0x5664, 0x9E11, 0xD9C2, 0x3DB4, 0x7A67, 0xB212, 0xF5C1, 0x32D9, 0x750A, 0xBD7F, 0xFAAC, 0x236E, 0x64BD,
0xACC8, 0xEB1B, 0x2C03, 0x6BD0, 0xA3A5, 0xE476, 0x7B68, 0x3CBB, 0xF4CE, 0xB31D, 0x7405, 0x33D6, 0xFBA3,
@@ -229,8 +221,8 @@ public sealed class CRC16CcittContext : Crc16Context
0x6081, 0xA8F4, 0xEF27, 0x7039, 0x37EA, 0xFF9F, 0xB84C, 0x7F54, 0x3887, 0xF0F2, 0xB721, 0x6EE3, 0x2930,
0xE145, 0xA696, 0x618E, 0x265D, 0xEE28, 0xA9FB, 0x4D8D, 0x0A5E, 0xC22B, 0x85F8, 0x42E0, 0x0533, 0xCD46,
0x8A95, 0x5357, 0x1484, 0xDCF1, 0x9B22, 0x5C3A, 0x1BE9, 0xD39C, 0x944F
}
};
]
];
/// <summary>Initializes an instance of the CRC16 with CCITT polynomial and seed.</summary>
/// <inheritdoc />

View File

@@ -46,9 +46,8 @@ public sealed class CRC16IbmContext : Crc16Context
internal const ushort CRC16_IBM_SEED = 0x0000;
static readonly ushort[][] _ibmCrc16Table =
{
new ushort[]
{
[
[
0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500,
0xC5C1, 0xC481, 0x0440, 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, 0x0A00, 0xCAC1,
0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81,
@@ -69,9 +68,8 @@ public sealed class CRC16IbmContext : Crc16Context
0x59C0, 0x5880, 0x9841, 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, 0x4E00, 0x8EC1,
0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680,
0x8641, 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
},
new ushort[]
{
],
[
0x0000, 0x9001, 0x6001, 0xF000, 0xC002, 0x5003, 0xA003, 0x3002, 0xC007, 0x5006, 0xA006, 0x3007, 0x0005,
0x9004, 0x6004, 0xF005, 0xC00D, 0x500C, 0xA00C, 0x300D, 0x000F, 0x900E, 0x600E, 0xF00F, 0x000A, 0x900B,
0x600B, 0xF00A, 0xC008, 0x5009, 0xA009, 0x3008, 0xC019, 0x5018, 0xA018, 0x3019, 0x001B, 0x901A, 0x601A,
@@ -92,9 +90,8 @@ public sealed class CRC16IbmContext : Crc16Context
0x5059, 0xA059, 0x3058, 0xC049, 0x5048, 0xA048, 0x3049, 0x004B, 0x904A, 0x604A, 0xF04B, 0x004E, 0x904F,
0x604F, 0xF04E, 0xC04C, 0x504D, 0xA04D, 0x304C, 0x0044, 0x9045, 0x6045, 0xF044, 0xC046, 0x5047, 0xA047,
0x3046, 0xC043, 0x5042, 0xA042, 0x3043, 0x0041, 0x9040, 0x6040, 0xF041
},
new ushort[]
{
],
[
0x0000, 0xC051, 0xC0A1, 0x00F0, 0xC141, 0x0110, 0x01E0, 0xC1B1, 0xC281, 0x02D0, 0x0220, 0xC271, 0x03C0,
0xC391, 0xC361, 0x0330, 0xC501, 0x0550, 0x05A0, 0xC5F1, 0x0440, 0xC411, 0xC4E1, 0x04B0, 0x0780, 0xC7D1,
0xC721, 0x0770, 0xC6C1, 0x0690, 0x0660, 0xC631, 0xCA01, 0x0A50, 0x0AA0, 0xCAF1, 0x0B40, 0xCB11, 0xCBE1,
@@ -115,9 +112,8 @@ public sealed class CRC16IbmContext : Crc16Context
0x3A90, 0x3A60, 0xFA31, 0xF601, 0x3650, 0x36A0, 0xF6F1, 0x3740, 0xF711, 0xF7E1, 0x37B0, 0x3480, 0xF4D1,
0xF421, 0x3470, 0xF5C1, 0x3590, 0x3560, 0xF531, 0x3300, 0xF351, 0xF3A1, 0x33F0, 0xF241, 0x3210, 0x32E0,
0xF2B1, 0xF181, 0x31D0, 0x3120, 0xF171, 0x30C0, 0xF091, 0xF061, 0x3030
},
new ushort[]
{
],
[
0x0000, 0xFC01, 0xB801, 0x4400, 0x3001, 0xCC00, 0x8800, 0x7401, 0x6002, 0x9C03, 0xD803, 0x2402, 0x5003,
0xAC02, 0xE802, 0x1403, 0xC004, 0x3C05, 0x7805, 0x8404, 0xF005, 0x0C04, 0x4804, 0xB405, 0xA006, 0x5C07,
0x1807, 0xE406, 0x9007, 0x6C06, 0x2806, 0xD407, 0xC00B, 0x3C0A, 0x780A, 0x840B, 0xF00A, 0x0C0B, 0x480B,
@@ -138,9 +134,8 @@ public sealed class CRC16IbmContext : Crc16Context
0x6C3A, 0x283A, 0xD43B, 0xC037, 0x3C36, 0x7836, 0x8437, 0xF036, 0x0C37, 0x4837, 0xB436, 0xA035, 0x5C34,
0x1834, 0xE435, 0x9034, 0x6C35, 0x2835, 0xD434, 0x0033, 0xFC32, 0xB832, 0x4433, 0x3032, 0xCC33, 0x8833,
0x7432, 0x6031, 0x9C30, 0xD830, 0x2431, 0x5030, 0xAC31, 0xE831, 0x1430
},
new ushort[]
{
],
[
0x0000, 0xC03D, 0xC079, 0x0044, 0xC0F1, 0x00CC, 0x0088, 0xC0B5, 0xC1E1, 0x01DC, 0x0198, 0xC1A5, 0x0110,
0xC12D, 0xC169, 0x0154, 0xC3C1, 0x03FC, 0x03B8, 0xC385, 0x0330, 0xC30D, 0xC349, 0x0374, 0x0220, 0xC21D,
0xC259, 0x0264, 0xC2D1, 0x02EC, 0x02A8, 0xC295, 0xC781, 0x07BC, 0x07F8, 0xC7C5, 0x0770, 0xC74D, 0xC709,
@@ -161,9 +156,8 @@ public sealed class CRC16IbmContext : Crc16Context
0x13EC, 0x13A8, 0xD395, 0xD681, 0x16BC, 0x16F8, 0xD6C5, 0x1670, 0xD64D, 0xD609, 0x1634, 0x1760, 0xD75D,
0xD719, 0x1724, 0xD791, 0x17AC, 0x17E8, 0xD7D5, 0x1540, 0xD57D, 0xD539, 0x1504, 0xD5B1, 0x158C, 0x15C8,
0xD5F5, 0xD4A1, 0x149C, 0x14D8, 0xD4E5, 0x1450, 0xD46D, 0xD429, 0x1414
},
new ushort[]
{
],
[
0x0000, 0xD101, 0xE201, 0x3300, 0x8401, 0x5500, 0x6600, 0xB701, 0x4801, 0x9900, 0xAA00, 0x7B01, 0xCC00,
0x1D01, 0x2E01, 0xFF00, 0x9002, 0x4103, 0x7203, 0xA302, 0x1403, 0xC502, 0xF602, 0x2703, 0xD803, 0x0902,
0x3A02, 0xEB03, 0x5C02, 0x8D03, 0xBE03, 0x6F02, 0x6007, 0xB106, 0x8206, 0x5307, 0xE406, 0x3507, 0x0607,
@@ -184,9 +178,8 @@ public sealed class CRC16IbmContext : Crc16Context
0x8D12, 0xBE12, 0x6F13, 0x6016, 0xB117, 0x8217, 0x5316, 0xE417, 0x3516, 0x0616, 0xD717, 0x2817, 0xF916,
0xCA16, 0x1B17, 0xAC16, 0x7D17, 0x4E17, 0x9F16, 0xF014, 0x2115, 0x1215, 0xC314, 0x7415, 0xA514, 0x9614,
0x4715, 0xB815, 0x6914, 0x5A14, 0x8B15, 0x3C14, 0xED15, 0xDE15, 0x0F14
},
new ushort[]
{
],
[
0x0000, 0xC010, 0xC023, 0x0033, 0xC045, 0x0055, 0x0066, 0xC076, 0xC089, 0x0099, 0x00AA, 0xC0BA, 0x00CC,
0xC0DC, 0xC0EF, 0x00FF, 0xC111, 0x0101, 0x0132, 0xC122, 0x0154, 0xC144, 0xC177, 0x0167, 0x0198, 0xC188,
0xC1BB, 0x01AB, 0xC1DD, 0x01CD, 0x01FE, 0xC1EE, 0xC221, 0x0231, 0x0202, 0xC212, 0x0264, 0xC274, 0xC247,
@@ -207,9 +200,8 @@ public sealed class CRC16IbmContext : Crc16Context
0x0D0D, 0x0D3E, 0xCD2E, 0xCEE1, 0x0EF1, 0x0EC2, 0xCED2, 0x0EA4, 0xCEB4, 0xCE87, 0x0E97, 0x0E68, 0xCE78,
0xCE4B, 0x0E5B, 0xCE2D, 0x0E3D, 0x0E0E, 0xCE1E, 0x0FF0, 0xCFE0, 0xCFD3, 0x0FC3, 0xCFB5, 0x0FA5, 0x0F96,
0xCF86, 0xCF79, 0x0F69, 0x0F5A, 0xCF4A, 0x0F3C, 0xCF2C, 0xCF1F, 0x0F0F
},
new ushort[]
{
],
[
0x0000, 0xCCC1, 0xD981, 0x1540, 0xF301, 0x3FC0, 0x2A80, 0xE641, 0xA601, 0x6AC0, 0x7F80, 0xB341, 0x5500,
0x99C1, 0x8C81, 0x4040, 0x0C01, 0xC0C0, 0xD580, 0x1941, 0xFF00, 0x33C1, 0x2681, 0xEA40, 0xAA00, 0x66C1,
0x7381, 0xBF40, 0x5901, 0x95C0, 0x8080, 0x4C41, 0x1802, 0xD4C3, 0xC183, 0x0D42, 0xEB03, 0x27C2, 0x3282,
@@ -230,8 +222,8 @@ public sealed class CRC16IbmContext : Crc16Context
0xC5CC, 0xD08C, 0x1C4D, 0x480E, 0x84CF, 0x918F, 0x5D4E, 0xBB0F, 0x77CE, 0x628E, 0xAE4F, 0xEE0F, 0x22CE,
0x378E, 0xFB4F, 0x1D0E, 0xD1CF, 0xC48F, 0x084E, 0x440F, 0x88CE, 0x9D8E, 0x514F, 0xB70E, 0x7BCF, 0x6E8F,
0xA24E, 0xE20E, 0x2ECF, 0x3B8F, 0xF74E, 0x110F, 0xDDCE, 0xC88E, 0x044F
}
};
]
];
/// <summary>Initializes an instance of the CRC16 with IBM polynomial and seed.</summary>
/// <inheritdoc />

View File

@@ -57,10 +57,10 @@ namespace Aaru.Checksums.CRC32;
static class Clmul
{
static readonly uint[] _crcK =
{
[
0xccaa009e, 0x00000000, /* rk1 */ 0x751997d0, 0x00000001, /* rk2 */ 0xccaa009e, 0x00000000, /* rk5 */
0x63cd6124, 0x00000001, /* rk6 */ 0xf7011640, 0x00000001, /* rk7 */ 0xdb710640, 0x00000001 /* rk8 */
};
];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static void Fold4(ref Vector128<uint> xmmCRC0, ref Vector128<uint> xmmCRC1, ref Vector128<uint> xmmCRC2,

View File

@@ -55,264 +55,280 @@ public sealed class Crc32Context : IChecksum
const uint CRC32_ISO_SEED = 0xFFFFFFFF;
internal static readonly uint[][] ISOCrc32Table =
{
new uint[]
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832,
0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A,
0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3,
0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB,
0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4,
0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074,
0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525,
0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615,
0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76,
0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E,
0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6,
0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7,
0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7,
0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278,
0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC,
0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330,
0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
},
new uint[]
{
0x00000000, 0x191B3141, 0x32366282, 0x2B2D53C3, 0x646CC504, 0x7D77F445, 0x565AA786, 0x4F4196C7, 0xC8D98A08,
0xD1C2BB49, 0xFAEFE88A, 0xE3F4D9CB, 0xACB54F0C, 0xB5AE7E4D, 0x9E832D8E, 0x87981CCF, 0x4AC21251, 0x53D92310,
0x78F470D3, 0x61EF4192, 0x2EAED755, 0x37B5E614, 0x1C98B5D7, 0x05838496, 0x821B9859, 0x9B00A918, 0xB02DFADB,
0xA936CB9A, 0xE6775D5D, 0xFF6C6C1C, 0xD4413FDF, 0xCD5A0E9E, 0x958424A2, 0x8C9F15E3, 0xA7B24620, 0xBEA97761,
0xF1E8E1A6, 0xE8F3D0E7, 0xC3DE8324, 0xDAC5B265, 0x5D5DAEAA, 0x44469FEB, 0x6F6BCC28, 0x7670FD69, 0x39316BAE,
0x202A5AEF, 0x0B07092C, 0x121C386D, 0xDF4636F3, 0xC65D07B2, 0xED705471, 0xF46B6530, 0xBB2AF3F7, 0xA231C2B6,
0x891C9175, 0x9007A034, 0x179FBCFB, 0x0E848DBA, 0x25A9DE79, 0x3CB2EF38, 0x73F379FF, 0x6AE848BE, 0x41C51B7D,
0x58DE2A3C, 0xF0794F05, 0xE9627E44, 0xC24F2D87, 0xDB541CC6, 0x94158A01, 0x8D0EBB40, 0xA623E883, 0xBF38D9C2,
0x38A0C50D, 0x21BBF44C, 0x0A96A78F, 0x138D96CE, 0x5CCC0009, 0x45D73148, 0x6EFA628B, 0x77E153CA, 0xBABB5D54,
0xA3A06C15, 0x888D3FD6, 0x91960E97, 0xDED79850, 0xC7CCA911, 0xECE1FAD2, 0xF5FACB93, 0x7262D75C, 0x6B79E61D,
0x4054B5DE, 0x594F849F, 0x160E1258, 0x0F152319, 0x243870DA, 0x3D23419B, 0x65FD6BA7, 0x7CE65AE6, 0x57CB0925,
0x4ED03864, 0x0191AEA3, 0x188A9FE2, 0x33A7CC21, 0x2ABCFD60, 0xAD24E1AF, 0xB43FD0EE, 0x9F12832D, 0x8609B26C,
0xC94824AB, 0xD05315EA, 0xFB7E4629, 0xE2657768, 0x2F3F79F6, 0x362448B7, 0x1D091B74, 0x04122A35, 0x4B53BCF2,
0x52488DB3, 0x7965DE70, 0x607EEF31, 0xE7E6F3FE, 0xFEFDC2BF, 0xD5D0917C, 0xCCCBA03D, 0x838A36FA, 0x9A9107BB,
0xB1BC5478, 0xA8A76539, 0x3B83984B, 0x2298A90A, 0x09B5FAC9, 0x10AECB88, 0x5FEF5D4F, 0x46F46C0E, 0x6DD93FCD,
0x74C20E8C, 0xF35A1243, 0xEA412302, 0xC16C70C1, 0xD8774180, 0x9736D747, 0x8E2DE606, 0xA500B5C5, 0xBC1B8484,
0x71418A1A, 0x685ABB5B, 0x4377E898, 0x5A6CD9D9, 0x152D4F1E, 0x0C367E5F, 0x271B2D9C, 0x3E001CDD, 0xB9980012,
0xA0833153, 0x8BAE6290, 0x92B553D1, 0xDDF4C516, 0xC4EFF457, 0xEFC2A794, 0xF6D996D5, 0xAE07BCE9, 0xB71C8DA8,
0x9C31DE6B, 0x852AEF2A, 0xCA6B79ED, 0xD37048AC, 0xF85D1B6F, 0xE1462A2E, 0x66DE36E1, 0x7FC507A0, 0x54E85463,
0x4DF36522, 0x02B2F3E5, 0x1BA9C2A4, 0x30849167, 0x299FA026, 0xE4C5AEB8, 0xFDDE9FF9, 0xD6F3CC3A, 0xCFE8FD7B,
0x80A96BBC, 0x99B25AFD, 0xB29F093E, 0xAB84387F, 0x2C1C24B0, 0x350715F1, 0x1E2A4632, 0x07317773, 0x4870E1B4,
0x516BD0F5, 0x7A468336, 0x635DB277, 0xCBFAD74E, 0xD2E1E60F, 0xF9CCB5CC, 0xE0D7848D, 0xAF96124A, 0xB68D230B,
0x9DA070C8, 0x84BB4189, 0x03235D46, 0x1A386C07, 0x31153FC4, 0x280E0E85, 0x674F9842, 0x7E54A903, 0x5579FAC0,
0x4C62CB81, 0x8138C51F, 0x9823F45E, 0xB30EA79D, 0xAA1596DC, 0xE554001B, 0xFC4F315A, 0xD7626299, 0xCE7953D8,
0x49E14F17, 0x50FA7E56, 0x7BD72D95, 0x62CC1CD4, 0x2D8D8A13, 0x3496BB52, 0x1FBBE891, 0x06A0D9D0, 0x5E7EF3EC,
0x4765C2AD, 0x6C48916E, 0x7553A02F, 0x3A1236E8, 0x230907A9, 0x0824546A, 0x113F652B, 0x96A779E4, 0x8FBC48A5,
0xA4911B66, 0xBD8A2A27, 0xF2CBBCE0, 0xEBD08DA1, 0xC0FDDE62, 0xD9E6EF23, 0x14BCE1BD, 0x0DA7D0FC, 0x268A833F,
0x3F91B27E, 0x70D024B9, 0x69CB15F8, 0x42E6463B, 0x5BFD777A, 0xDC656BB5, 0xC57E5AF4, 0xEE530937, 0xF7483876,
0xB809AEB1, 0xA1129FF0, 0x8A3FCC33, 0x9324FD72
},
new uint[]
{
0x00000000, 0x01C26A37, 0x0384D46E, 0x0246BE59, 0x0709A8DC, 0x06CBC2EB, 0x048D7CB2, 0x054F1685, 0x0E1351B8,
0x0FD13B8F, 0x0D9785D6, 0x0C55EFE1, 0x091AF964, 0x08D89353, 0x0A9E2D0A, 0x0B5C473D, 0x1C26A370, 0x1DE4C947,
0x1FA2771E, 0x1E601D29, 0x1B2F0BAC, 0x1AED619B, 0x18ABDFC2, 0x1969B5F5, 0x1235F2C8, 0x13F798FF, 0x11B126A6,
0x10734C91, 0x153C5A14, 0x14FE3023, 0x16B88E7A, 0x177AE44D, 0x384D46E0, 0x398F2CD7, 0x3BC9928E, 0x3A0BF8B9,
0x3F44EE3C, 0x3E86840B, 0x3CC03A52, 0x3D025065, 0x365E1758, 0x379C7D6F, 0x35DAC336, 0x3418A901, 0x3157BF84,
0x3095D5B3, 0x32D36BEA, 0x331101DD, 0x246BE590, 0x25A98FA7, 0x27EF31FE, 0x262D5BC9, 0x23624D4C, 0x22A0277B,
0x20E69922, 0x2124F315, 0x2A78B428, 0x2BBADE1F, 0x29FC6046, 0x283E0A71, 0x2D711CF4, 0x2CB376C3, 0x2EF5C89A,
0x2F37A2AD, 0x709A8DC0, 0x7158E7F7, 0x731E59AE, 0x72DC3399, 0x7793251C, 0x76514F2B, 0x7417F172, 0x75D59B45,
0x7E89DC78, 0x7F4BB64F, 0x7D0D0816, 0x7CCF6221, 0x798074A4, 0x78421E93, 0x7A04A0CA, 0x7BC6CAFD, 0x6CBC2EB0,
0x6D7E4487, 0x6F38FADE, 0x6EFA90E9, 0x6BB5866C, 0x6A77EC5B, 0x68315202, 0x69F33835, 0x62AF7F08, 0x636D153F,
0x612BAB66, 0x60E9C151, 0x65A6D7D4, 0x6464BDE3, 0x662203BA, 0x67E0698D, 0x48D7CB20, 0x4915A117, 0x4B531F4E,
0x4A917579, 0x4FDE63FC, 0x4E1C09CB, 0x4C5AB792, 0x4D98DDA5, 0x46C49A98, 0x4706F0AF, 0x45404EF6, 0x448224C1,
0x41CD3244, 0x400F5873, 0x4249E62A, 0x438B8C1D, 0x54F16850, 0x55330267, 0x5775BC3E, 0x56B7D609, 0x53F8C08C,
0x523AAABB, 0x507C14E2, 0x51BE7ED5, 0x5AE239E8, 0x5B2053DF, 0x5966ED86, 0x58A487B1, 0x5DEB9134, 0x5C29FB03,
0x5E6F455A, 0x5FAD2F6D, 0xE1351B80, 0xE0F771B7, 0xE2B1CFEE, 0xE373A5D9, 0xE63CB35C, 0xE7FED96B, 0xE5B86732,
0xE47A0D05, 0xEF264A38, 0xEEE4200F, 0xECA29E56, 0xED60F461, 0xE82FE2E4, 0xE9ED88D3, 0xEBAB368A, 0xEA695CBD,
0xFD13B8F0, 0xFCD1D2C7, 0xFE976C9E, 0xFF5506A9, 0xFA1A102C, 0xFBD87A1B, 0xF99EC442, 0xF85CAE75, 0xF300E948,
0xF2C2837F, 0xF0843D26, 0xF1465711, 0xF4094194, 0xF5CB2BA3, 0xF78D95FA, 0xF64FFFCD, 0xD9785D60, 0xD8BA3757,
0xDAFC890E, 0xDB3EE339, 0xDE71F5BC, 0xDFB39F8B, 0xDDF521D2, 0xDC374BE5, 0xD76B0CD8, 0xD6A966EF, 0xD4EFD8B6,
0xD52DB281, 0xD062A404, 0xD1A0CE33, 0xD3E6706A, 0xD2241A5D, 0xC55EFE10, 0xC49C9427, 0xC6DA2A7E, 0xC7184049,
0xC25756CC, 0xC3953CFB, 0xC1D382A2, 0xC011E895, 0xCB4DAFA8, 0xCA8FC59F, 0xC8C97BC6, 0xC90B11F1, 0xCC440774,
0xCD866D43, 0xCFC0D31A, 0xCE02B92D, 0x91AF9640, 0x906DFC77, 0x922B422E, 0x93E92819, 0x96A63E9C, 0x976454AB,
0x9522EAF2, 0x94E080C5, 0x9FBCC7F8, 0x9E7EADCF, 0x9C381396, 0x9DFA79A1, 0x98B56F24, 0x99770513, 0x9B31BB4A,
0x9AF3D17D, 0x8D893530, 0x8C4B5F07, 0x8E0DE15E, 0x8FCF8B69, 0x8A809DEC, 0x8B42F7DB, 0x89044982, 0x88C623B5,
0x839A6488, 0x82580EBF, 0x801EB0E6, 0x81DCDAD1, 0x8493CC54, 0x8551A663, 0x8717183A, 0x86D5720D, 0xA9E2D0A0,
0xA820BA97, 0xAA6604CE, 0xABA46EF9, 0xAEEB787C, 0xAF29124B, 0xAD6FAC12, 0xACADC625, 0xA7F18118, 0xA633EB2F,
0xA4755576, 0xA5B73F41, 0xA0F829C4, 0xA13A43F3, 0xA37CFDAA, 0xA2BE979D, 0xB5C473D0, 0xB40619E7, 0xB640A7BE,
0xB782CD89, 0xB2CDDB0C, 0xB30FB13B, 0xB1490F62, 0xB08B6555, 0xBBD72268, 0xBA15485F, 0xB853F606, 0xB9919C31,
0xBCDE8AB4, 0xBD1CE083, 0xBF5A5EDA, 0xBE9834ED
},
new uint[]
{
0x00000000, 0xB8BC6765, 0xAA09C88B, 0x12B5AFEE, 0x8F629757, 0x37DEF032, 0x256B5FDC, 0x9DD738B9, 0xC5B428EF,
0x7D084F8A, 0x6FBDE064, 0xD7018701, 0x4AD6BFB8, 0xF26AD8DD, 0xE0DF7733, 0x58631056, 0x5019579F, 0xE8A530FA,
0xFA109F14, 0x42ACF871, 0xDF7BC0C8, 0x67C7A7AD, 0x75720843, 0xCDCE6F26, 0x95AD7F70, 0x2D111815, 0x3FA4B7FB,
0x8718D09E, 0x1ACFE827, 0xA2738F42, 0xB0C620AC, 0x087A47C9, 0xA032AF3E, 0x188EC85B, 0x0A3B67B5, 0xB28700D0,
0x2F503869, 0x97EC5F0C, 0x8559F0E2, 0x3DE59787, 0x658687D1, 0xDD3AE0B4, 0xCF8F4F5A, 0x7733283F, 0xEAE41086,
0x525877E3, 0x40EDD80D, 0xF851BF68, 0xF02BF8A1, 0x48979FC4, 0x5A22302A, 0xE29E574F, 0x7F496FF6, 0xC7F50893,
0xD540A77D, 0x6DFCC018, 0x359FD04E, 0x8D23B72B, 0x9F9618C5, 0x272A7FA0, 0xBAFD4719, 0x0241207C, 0x10F48F92,
0xA848E8F7, 0x9B14583D, 0x23A83F58, 0x311D90B6, 0x89A1F7D3, 0x1476CF6A, 0xACCAA80F, 0xBE7F07E1, 0x06C36084,
0x5EA070D2, 0xE61C17B7, 0xF4A9B859, 0x4C15DF3C, 0xD1C2E785, 0x697E80E0, 0x7BCB2F0E, 0xC377486B, 0xCB0D0FA2,
0x73B168C7, 0x6104C729, 0xD9B8A04C, 0x446F98F5, 0xFCD3FF90, 0xEE66507E, 0x56DA371B, 0x0EB9274D, 0xB6054028,
0xA4B0EFC6, 0x1C0C88A3, 0x81DBB01A, 0x3967D77F, 0x2BD27891, 0x936E1FF4, 0x3B26F703, 0x839A9066, 0x912F3F88,
0x299358ED, 0xB4446054, 0x0CF80731, 0x1E4DA8DF, 0xA6F1CFBA, 0xFE92DFEC, 0x462EB889, 0x549B1767, 0xEC277002,
0x71F048BB, 0xC94C2FDE, 0xDBF98030, 0x6345E755, 0x6B3FA09C, 0xD383C7F9, 0xC1366817, 0x798A0F72, 0xE45D37CB,
0x5CE150AE, 0x4E54FF40, 0xF6E89825, 0xAE8B8873, 0x1637EF16, 0x048240F8, 0xBC3E279D, 0x21E91F24, 0x99557841,
0x8BE0D7AF, 0x335CB0CA, 0xED59B63B, 0x55E5D15E, 0x47507EB0, 0xFFEC19D5, 0x623B216C, 0xDA874609, 0xC832E9E7,
0x708E8E82, 0x28ED9ED4, 0x9051F9B1, 0x82E4565F, 0x3A58313A, 0xA78F0983, 0x1F336EE6, 0x0D86C108, 0xB53AA66D,
0xBD40E1A4, 0x05FC86C1, 0x1749292F, 0xAFF54E4A, 0x322276F3, 0x8A9E1196, 0x982BBE78, 0x2097D91D, 0x78F4C94B,
0xC048AE2E, 0xD2FD01C0, 0x6A4166A5, 0xF7965E1C, 0x4F2A3979, 0x5D9F9697, 0xE523F1F2, 0x4D6B1905, 0xF5D77E60,
0xE762D18E, 0x5FDEB6EB, 0xC2098E52, 0x7AB5E937, 0x680046D9, 0xD0BC21BC, 0x88DF31EA, 0x3063568F, 0x22D6F961,
0x9A6A9E04, 0x07BDA6BD, 0xBF01C1D8, 0xADB46E36, 0x15080953, 0x1D724E9A, 0xA5CE29FF, 0xB77B8611, 0x0FC7E174,
0x9210D9CD, 0x2AACBEA8, 0x38191146, 0x80A57623, 0xD8C66675, 0x607A0110, 0x72CFAEFE, 0xCA73C99B, 0x57A4F122,
0xEF189647, 0xFDAD39A9, 0x45115ECC, 0x764DEE06, 0xCEF18963, 0xDC44268D, 0x64F841E8, 0xF92F7951, 0x41931E34,
0x5326B1DA, 0xEB9AD6BF, 0xB3F9C6E9, 0x0B45A18C, 0x19F00E62, 0xA14C6907, 0x3C9B51BE, 0x842736DB, 0x96929935,
0x2E2EFE50, 0x2654B999, 0x9EE8DEFC, 0x8C5D7112, 0x34E11677, 0xA9362ECE, 0x118A49AB, 0x033FE645, 0xBB838120,
0xE3E09176, 0x5B5CF613, 0x49E959FD, 0xF1553E98, 0x6C820621, 0xD43E6144, 0xC68BCEAA, 0x7E37A9CF, 0xD67F4138,
0x6EC3265D, 0x7C7689B3, 0xC4CAEED6, 0x591DD66F, 0xE1A1B10A, 0xF3141EE4, 0x4BA87981, 0x13CB69D7, 0xAB770EB2,
0xB9C2A15C, 0x017EC639, 0x9CA9FE80, 0x241599E5, 0x36A0360B, 0x8E1C516E, 0x866616A7, 0x3EDA71C2, 0x2C6FDE2C,
0x94D3B949, 0x090481F0, 0xB1B8E695, 0xA30D497B, 0x1BB12E1E, 0x43D23E48, 0xFB6E592D, 0xE9DBF6C3, 0x516791A6,
0xCCB0A91F, 0x740CCE7A, 0x66B96194, 0xDE0506F1
},
new uint[]
{
0x00000000, 0x3D6029B0, 0x7AC05360, 0x47A07AD0, 0xF580A6C0, 0xC8E08F70, 0x8F40F5A0, 0xB220DC10, 0x30704BC1,
0x0D106271, 0x4AB018A1, 0x77D03111, 0xC5F0ED01, 0xF890C4B1, 0xBF30BE61, 0x825097D1, 0x60E09782, 0x5D80BE32,
0x1A20C4E2, 0x2740ED52, 0x95603142, 0xA80018F2, 0xEFA06222, 0xD2C04B92, 0x5090DC43, 0x6DF0F5F3, 0x2A508F23,
0x1730A693, 0xA5107A83, 0x98705333, 0xDFD029E3, 0xE2B00053, 0xC1C12F04, 0xFCA106B4, 0xBB017C64, 0x866155D4,
0x344189C4, 0x0921A074, 0x4E81DAA4, 0x73E1F314, 0xF1B164C5, 0xCCD14D75, 0x8B7137A5, 0xB6111E15, 0x0431C205,
0x3951EBB5, 0x7EF19165, 0x4391B8D5, 0xA121B886, 0x9C419136, 0xDBE1EBE6, 0xE681C256, 0x54A11E46, 0x69C137F6,
0x2E614D26, 0x13016496, 0x9151F347, 0xAC31DAF7, 0xEB91A027, 0xD6F18997, 0x64D15587, 0x59B17C37, 0x1E1106E7,
0x23712F57, 0x58F35849, 0x659371F9, 0x22330B29, 0x1F532299, 0xAD73FE89, 0x9013D739, 0xD7B3ADE9, 0xEAD38459,
0x68831388, 0x55E33A38, 0x124340E8, 0x2F236958, 0x9D03B548, 0xA0639CF8, 0xE7C3E628, 0xDAA3CF98, 0x3813CFCB,
0x0573E67B, 0x42D39CAB, 0x7FB3B51B, 0xCD93690B, 0xF0F340BB, 0xB7533A6B, 0x8A3313DB, 0x0863840A, 0x3503ADBA,
0x72A3D76A, 0x4FC3FEDA, 0xFDE322CA, 0xC0830B7A, 0x872371AA, 0xBA43581A, 0x9932774D, 0xA4525EFD, 0xE3F2242D,
0xDE920D9D, 0x6CB2D18D, 0x51D2F83D, 0x167282ED, 0x2B12AB5D, 0xA9423C8C, 0x9422153C, 0xD3826FEC, 0xEEE2465C,
0x5CC29A4C, 0x61A2B3FC, 0x2602C92C, 0x1B62E09C, 0xF9D2E0CF, 0xC4B2C97F, 0x8312B3AF, 0xBE729A1F, 0x0C52460F,
0x31326FBF, 0x7692156F, 0x4BF23CDF, 0xC9A2AB0E, 0xF4C282BE, 0xB362F86E, 0x8E02D1DE, 0x3C220DCE, 0x0142247E,
0x46E25EAE, 0x7B82771E, 0xB1E6B092, 0x8C869922, 0xCB26E3F2, 0xF646CA42, 0x44661652, 0x79063FE2, 0x3EA64532,
0x03C66C82, 0x8196FB53, 0xBCF6D2E3, 0xFB56A833, 0xC6368183, 0x74165D93, 0x49767423, 0x0ED60EF3, 0x33B62743,
0xD1062710, 0xEC660EA0, 0xABC67470, 0x96A65DC0, 0x248681D0, 0x19E6A860, 0x5E46D2B0, 0x6326FB00, 0xE1766CD1,
0xDC164561, 0x9BB63FB1, 0xA6D61601, 0x14F6CA11, 0x2996E3A1, 0x6E369971, 0x5356B0C1, 0x70279F96, 0x4D47B626,
0x0AE7CCF6, 0x3787E546, 0x85A73956, 0xB8C710E6, 0xFF676A36, 0xC2074386, 0x4057D457, 0x7D37FDE7, 0x3A978737,
0x07F7AE87, 0xB5D77297, 0x88B75B27, 0xCF1721F7, 0xF2770847, 0x10C70814, 0x2DA721A4, 0x6A075B74, 0x576772C4,
0xE547AED4, 0xD8278764, 0x9F87FDB4, 0xA2E7D404, 0x20B743D5, 0x1DD76A65, 0x5A7710B5, 0x67173905, 0xD537E515,
0xE857CCA5, 0xAFF7B675, 0x92979FC5, 0xE915E8DB, 0xD475C16B, 0x93D5BBBB, 0xAEB5920B, 0x1C954E1B, 0x21F567AB,
0x66551D7B, 0x5B3534CB, 0xD965A31A, 0xE4058AAA, 0xA3A5F07A, 0x9EC5D9CA, 0x2CE505DA, 0x11852C6A, 0x562556BA,
0x6B457F0A, 0x89F57F59, 0xB49556E9, 0xF3352C39, 0xCE550589, 0x7C75D999, 0x4115F029, 0x06B58AF9, 0x3BD5A349,
0xB9853498, 0x84E51D28, 0xC34567F8, 0xFE254E48, 0x4C059258, 0x7165BBE8, 0x36C5C138, 0x0BA5E888, 0x28D4C7DF,
0x15B4EE6F, 0x521494BF, 0x6F74BD0F, 0xDD54611F, 0xE03448AF, 0xA794327F, 0x9AF41BCF, 0x18A48C1E, 0x25C4A5AE,
0x6264DF7E, 0x5F04F6CE, 0xED242ADE, 0xD044036E, 0x97E479BE, 0xAA84500E, 0x4834505D, 0x755479ED, 0x32F4033D,
0x0F942A8D, 0xBDB4F69D, 0x80D4DF2D, 0xC774A5FD, 0xFA148C4D, 0x78441B9C, 0x4524322C, 0x028448FC, 0x3FE4614C,
0x8DC4BD5C, 0xB0A494EC, 0xF704EE3C, 0xCA64C78C
},
new uint[]
{
0x00000000, 0xCB5CD3A5, 0x4DC8A10B, 0x869472AE, 0x9B914216, 0x50CD91B3, 0xD659E31D, 0x1D0530B8, 0xEC53826D,
0x270F51C8, 0xA19B2366, 0x6AC7F0C3, 0x77C2C07B, 0xBC9E13DE, 0x3A0A6170, 0xF156B2D5, 0x03D6029B, 0xC88AD13E,
0x4E1EA390, 0x85427035, 0x9847408D, 0x531B9328, 0xD58FE186, 0x1ED33223, 0xEF8580F6, 0x24D95353, 0xA24D21FD,
0x6911F258, 0x7414C2E0, 0xBF481145, 0x39DC63EB, 0xF280B04E, 0x07AC0536, 0xCCF0D693, 0x4A64A43D, 0x81387798,
0x9C3D4720, 0x57619485, 0xD1F5E62B, 0x1AA9358E, 0xEBFF875B, 0x20A354FE, 0xA6372650, 0x6D6BF5F5, 0x706EC54D,
0xBB3216E8, 0x3DA66446, 0xF6FAB7E3, 0x047A07AD, 0xCF26D408, 0x49B2A6A6, 0x82EE7503, 0x9FEB45BB, 0x54B7961E,
0xD223E4B0, 0x197F3715, 0xE82985C0, 0x23755665, 0xA5E124CB, 0x6EBDF76E, 0x73B8C7D6, 0xB8E41473, 0x3E7066DD,
0xF52CB578, 0x0F580A6C, 0xC404D9C9, 0x4290AB67, 0x89CC78C2, 0x94C9487A, 0x5F959BDF, 0xD901E971, 0x125D3AD4,
0xE30B8801, 0x28575BA4, 0xAEC3290A, 0x659FFAAF, 0x789ACA17, 0xB3C619B2, 0x35526B1C, 0xFE0EB8B9, 0x0C8E08F7,
0xC7D2DB52, 0x4146A9FC, 0x8A1A7A59, 0x971F4AE1, 0x5C439944, 0xDAD7EBEA, 0x118B384F, 0xE0DD8A9A, 0x2B81593F,
0xAD152B91, 0x6649F834, 0x7B4CC88C, 0xB0101B29, 0x36846987, 0xFDD8BA22, 0x08F40F5A, 0xC3A8DCFF, 0x453CAE51,
0x8E607DF4, 0x93654D4C, 0x58399EE9, 0xDEADEC47, 0x15F13FE2, 0xE4A78D37, 0x2FFB5E92, 0xA96F2C3C, 0x6233FF99,
0x7F36CF21, 0xB46A1C84, 0x32FE6E2A, 0xF9A2BD8F, 0x0B220DC1, 0xC07EDE64, 0x46EAACCA, 0x8DB67F6F, 0x90B34FD7,
0x5BEF9C72, 0xDD7BEEDC, 0x16273D79, 0xE7718FAC, 0x2C2D5C09, 0xAAB92EA7, 0x61E5FD02, 0x7CE0CDBA, 0xB7BC1E1F,
0x31286CB1, 0xFA74BF14, 0x1EB014D8, 0xD5ECC77D, 0x5378B5D3, 0x98246676, 0x852156CE, 0x4E7D856B, 0xC8E9F7C5,
0x03B52460, 0xF2E396B5, 0x39BF4510, 0xBF2B37BE, 0x7477E41B, 0x6972D4A3, 0xA22E0706, 0x24BA75A8, 0xEFE6A60D,
0x1D661643, 0xD63AC5E6, 0x50AEB748, 0x9BF264ED, 0x86F75455, 0x4DAB87F0, 0xCB3FF55E, 0x006326FB, 0xF135942E,
0x3A69478B, 0xBCFD3525, 0x77A1E680, 0x6AA4D638, 0xA1F8059D, 0x276C7733, 0xEC30A496, 0x191C11EE, 0xD240C24B,
0x54D4B0E5, 0x9F886340, 0x828D53F8, 0x49D1805D, 0xCF45F2F3, 0x04192156, 0xF54F9383, 0x3E134026, 0xB8873288,
0x73DBE12D, 0x6EDED195, 0xA5820230, 0x2316709E, 0xE84AA33B, 0x1ACA1375, 0xD196C0D0, 0x5702B27E, 0x9C5E61DB,
0x815B5163, 0x4A0782C6, 0xCC93F068, 0x07CF23CD, 0xF6999118, 0x3DC542BD, 0xBB513013, 0x700DE3B6, 0x6D08D30E,
0xA65400AB, 0x20C07205, 0xEB9CA1A0, 0x11E81EB4, 0xDAB4CD11, 0x5C20BFBF, 0x977C6C1A, 0x8A795CA2, 0x41258F07,
0xC7B1FDA9, 0x0CED2E0C, 0xFDBB9CD9, 0x36E74F7C, 0xB0733DD2, 0x7B2FEE77, 0x662ADECF, 0xAD760D6A, 0x2BE27FC4,
0xE0BEAC61, 0x123E1C2F, 0xD962CF8A, 0x5FF6BD24, 0x94AA6E81, 0x89AF5E39, 0x42F38D9C, 0xC467FF32, 0x0F3B2C97,
0xFE6D9E42, 0x35314DE7, 0xB3A53F49, 0x78F9ECEC, 0x65FCDC54, 0xAEA00FF1, 0x28347D5F, 0xE368AEFA, 0x16441B82,
0xDD18C827, 0x5B8CBA89, 0x90D0692C, 0x8DD55994, 0x46898A31, 0xC01DF89F, 0x0B412B3A, 0xFA1799EF, 0x314B4A4A,
0xB7DF38E4, 0x7C83EB41, 0x6186DBF9, 0xAADA085C, 0x2C4E7AF2, 0xE712A957, 0x15921919, 0xDECECABC, 0x585AB812,
0x93066BB7, 0x8E035B0F, 0x455F88AA, 0xC3CBFA04, 0x089729A1, 0xF9C19B74, 0x329D48D1, 0xB4093A7F, 0x7F55E9DA,
0x6250D962, 0xA90C0AC7, 0x2F987869, 0xE4C4ABCC
},
new uint[]
{
0x00000000, 0xA6770BB4, 0x979F1129, 0x31E81A9D, 0xF44F2413, 0x52382FA7, 0x63D0353A, 0xC5A73E8E, 0x33EF4E67,
0x959845D3, 0xA4705F4E, 0x020754FA, 0xC7A06A74, 0x61D761C0, 0x503F7B5D, 0xF64870E9, 0x67DE9CCE, 0xC1A9977A,
0xF0418DE7, 0x56368653, 0x9391B8DD, 0x35E6B369, 0x040EA9F4, 0xA279A240, 0x5431D2A9, 0xF246D91D, 0xC3AEC380,
0x65D9C834, 0xA07EF6BA, 0x0609FD0E, 0x37E1E793, 0x9196EC27, 0xCFBD399C, 0x69CA3228, 0x582228B5, 0xFE552301,
0x3BF21D8F, 0x9D85163B, 0xAC6D0CA6, 0x0A1A0712, 0xFC5277FB, 0x5A257C4F, 0x6BCD66D2, 0xCDBA6D66, 0x081D53E8,
0xAE6A585C, 0x9F8242C1, 0x39F54975, 0xA863A552, 0x0E14AEE6, 0x3FFCB47B, 0x998BBFCF, 0x5C2C8141, 0xFA5B8AF5,
0xCBB39068, 0x6DC49BDC, 0x9B8CEB35, 0x3DFBE081, 0x0C13FA1C, 0xAA64F1A8, 0x6FC3CF26, 0xC9B4C492, 0xF85CDE0F,
0x5E2BD5BB, 0x440B7579, 0xE27C7ECD, 0xD3946450, 0x75E36FE4, 0xB044516A, 0x16335ADE, 0x27DB4043, 0x81AC4BF7,
0x77E43B1E, 0xD19330AA, 0xE07B2A37, 0x460C2183, 0x83AB1F0D, 0x25DC14B9, 0x14340E24, 0xB2430590, 0x23D5E9B7,
0x85A2E203, 0xB44AF89E, 0x123DF32A, 0xD79ACDA4, 0x71EDC610, 0x4005DC8D, 0xE672D739, 0x103AA7D0, 0xB64DAC64,
0x87A5B6F9, 0x21D2BD4D, 0xE47583C3, 0x42028877, 0x73EA92EA, 0xD59D995E, 0x8BB64CE5, 0x2DC14751, 0x1C295DCC,
0xBA5E5678, 0x7FF968F6, 0xD98E6342, 0xE86679DF, 0x4E11726B, 0xB8590282, 0x1E2E0936, 0x2FC613AB, 0x89B1181F,
0x4C162691, 0xEA612D25, 0xDB8937B8, 0x7DFE3C0C, 0xEC68D02B, 0x4A1FDB9F, 0x7BF7C102, 0xDD80CAB6, 0x1827F438,
0xBE50FF8C, 0x8FB8E511, 0x29CFEEA5, 0xDF879E4C, 0x79F095F8, 0x48188F65, 0xEE6F84D1, 0x2BC8BA5F, 0x8DBFB1EB,
0xBC57AB76, 0x1A20A0C2, 0x8816EAF2, 0x2E61E146, 0x1F89FBDB, 0xB9FEF06F, 0x7C59CEE1, 0xDA2EC555, 0xEBC6DFC8,
0x4DB1D47C, 0xBBF9A495, 0x1D8EAF21, 0x2C66B5BC, 0x8A11BE08, 0x4FB68086, 0xE9C18B32, 0xD82991AF, 0x7E5E9A1B,
0xEFC8763C, 0x49BF7D88, 0x78576715, 0xDE206CA1, 0x1B87522F, 0xBDF0599B, 0x8C184306, 0x2A6F48B2, 0xDC27385B,
0x7A5033EF, 0x4BB82972, 0xEDCF22C6, 0x28681C48, 0x8E1F17FC, 0xBFF70D61, 0x198006D5, 0x47ABD36E, 0xE1DCD8DA,
0xD034C247, 0x7643C9F3, 0xB3E4F77D, 0x1593FCC9, 0x247BE654, 0x820CEDE0, 0x74449D09, 0xD23396BD, 0xE3DB8C20,
0x45AC8794, 0x800BB91A, 0x267CB2AE, 0x1794A833, 0xB1E3A387, 0x20754FA0, 0x86024414, 0xB7EA5E89, 0x119D553D,
0xD43A6BB3, 0x724D6007, 0x43A57A9A, 0xE5D2712E, 0x139A01C7, 0xB5ED0A73, 0x840510EE, 0x22721B5A, 0xE7D525D4,
0x41A22E60, 0x704A34FD, 0xD63D3F49, 0xCC1D9F8B, 0x6A6A943F, 0x5B828EA2, 0xFDF58516, 0x3852BB98, 0x9E25B02C,
0xAFCDAAB1, 0x09BAA105, 0xFFF2D1EC, 0x5985DA58, 0x686DC0C5, 0xCE1ACB71, 0x0BBDF5FF, 0xADCAFE4B, 0x9C22E4D6,
0x3A55EF62, 0xABC30345, 0x0DB408F1, 0x3C5C126C, 0x9A2B19D8, 0x5F8C2756, 0xF9FB2CE2, 0xC813367F, 0x6E643DCB,
0x982C4D22, 0x3E5B4696, 0x0FB35C0B, 0xA9C457BF, 0x6C636931, 0xCA146285, 0xFBFC7818, 0x5D8B73AC, 0x03A0A617,
0xA5D7ADA3, 0x943FB73E, 0x3248BC8A, 0xF7EF8204, 0x519889B0, 0x6070932D, 0xC6079899, 0x304FE870, 0x9638E3C4,
0xA7D0F959, 0x01A7F2ED, 0xC400CC63, 0x6277C7D7, 0x539FDD4A, 0xF5E8D6FE, 0x647E3AD9, 0xC209316D, 0xF3E12BF0,
0x55962044, 0x90311ECA, 0x3646157E, 0x07AE0FE3, 0xA1D90457, 0x579174BE, 0xF1E67F0A, 0xC00E6597, 0x66796E23,
0xA3DE50AD, 0x05A95B19, 0x34414184, 0x92364A30
},
new uint[]
{
0x00000000, 0xCCAA009E, 0x4225077D, 0x8E8F07E3, 0x844A0EFA, 0x48E00E64, 0xC66F0987, 0x0AC50919, 0xD3E51BB5,
0x1F4F1B2B, 0x91C01CC8, 0x5D6A1C56, 0x57AF154F, 0x9B0515D1, 0x158A1232, 0xD92012AC, 0x7CBB312B, 0xB01131B5,
0x3E9E3656, 0xF23436C8, 0xF8F13FD1, 0x345B3F4F, 0xBAD438AC, 0x767E3832, 0xAF5E2A9E, 0x63F42A00, 0xED7B2DE3,
0x21D12D7D, 0x2B142464, 0xE7BE24FA, 0x69312319, 0xA59B2387, 0xF9766256, 0x35DC62C8, 0xBB53652B, 0x77F965B5,
0x7D3C6CAC, 0xB1966C32, 0x3F196BD1, 0xF3B36B4F, 0x2A9379E3, 0xE639797D, 0x68B67E9E, 0xA41C7E00, 0xAED97719,
0x62737787, 0xECFC7064, 0x205670FA, 0x85CD537D, 0x496753E3, 0xC7E85400, 0x0B42549E, 0x01875D87, 0xCD2D5D19,
0x43A25AFA, 0x8F085A64, 0x562848C8, 0x9A824856, 0x140D4FB5, 0xD8A74F2B, 0xD2624632, 0x1EC846AC, 0x9047414F,
0x5CED41D1, 0x299DC2ED, 0xE537C273, 0x6BB8C590, 0xA712C50E, 0xADD7CC17, 0x617DCC89, 0xEFF2CB6A, 0x2358CBF4,
0xFA78D958, 0x36D2D9C6, 0xB85DDE25, 0x74F7DEBB, 0x7E32D7A2, 0xB298D73C, 0x3C17D0DF, 0xF0BDD041, 0x5526F3C6,
0x998CF358, 0x1703F4BB, 0xDBA9F425, 0xD16CFD3C, 0x1DC6FDA2, 0x9349FA41, 0x5FE3FADF, 0x86C3E873, 0x4A69E8ED,
0xC4E6EF0E, 0x084CEF90, 0x0289E689, 0xCE23E617, 0x40ACE1F4, 0x8C06E16A, 0xD0EBA0BB, 0x1C41A025, 0x92CEA7C6,
0x5E64A758, 0x54A1AE41, 0x980BAEDF, 0x1684A93C, 0xDA2EA9A2, 0x030EBB0E, 0xCFA4BB90, 0x412BBC73, 0x8D81BCED,
0x8744B5F4, 0x4BEEB56A, 0xC561B289, 0x09CBB217, 0xAC509190, 0x60FA910E, 0xEE7596ED, 0x22DF9673, 0x281A9F6A,
0xE4B09FF4, 0x6A3F9817, 0xA6959889, 0x7FB58A25, 0xB31F8ABB, 0x3D908D58, 0xF13A8DC6, 0xFBFF84DF, 0x37558441,
0xB9DA83A2, 0x7570833C, 0x533B85DA, 0x9F918544, 0x111E82A7, 0xDDB48239, 0xD7718B20, 0x1BDB8BBE, 0x95548C5D,
0x59FE8CC3, 0x80DE9E6F, 0x4C749EF1, 0xC2FB9912, 0x0E51998C, 0x04949095, 0xC83E900B, 0x46B197E8, 0x8A1B9776,
0x2F80B4F1, 0xE32AB46F, 0x6DA5B38C, 0xA10FB312, 0xABCABA0B, 0x6760BA95, 0xE9EFBD76, 0x2545BDE8, 0xFC65AF44,
0x30CFAFDA, 0xBE40A839, 0x72EAA8A7, 0x782FA1BE, 0xB485A120, 0x3A0AA6C3, 0xF6A0A65D, 0xAA4DE78C, 0x66E7E712,
0xE868E0F1, 0x24C2E06F, 0x2E07E976, 0xE2ADE9E8, 0x6C22EE0B, 0xA088EE95, 0x79A8FC39, 0xB502FCA7, 0x3B8DFB44,
0xF727FBDA, 0xFDE2F2C3, 0x3148F25D, 0xBFC7F5BE, 0x736DF520, 0xD6F6D6A7, 0x1A5CD639, 0x94D3D1DA, 0x5879D144,
0x52BCD85D, 0x9E16D8C3, 0x1099DF20, 0xDC33DFBE, 0x0513CD12, 0xC9B9CD8C, 0x4736CA6F, 0x8B9CCAF1, 0x8159C3E8,
0x4DF3C376, 0xC37CC495, 0x0FD6C40B, 0x7AA64737, 0xB60C47A9, 0x3883404A, 0xF42940D4, 0xFEEC49CD, 0x32464953,
0xBCC94EB0, 0x70634E2E, 0xA9435C82, 0x65E95C1C, 0xEB665BFF, 0x27CC5B61, 0x2D095278, 0xE1A352E6, 0x6F2C5505,
0xA386559B, 0x061D761C, 0xCAB77682, 0x44387161, 0x889271FF, 0x825778E6, 0x4EFD7878, 0xC0727F9B, 0x0CD87F05,
0xD5F86DA9, 0x19526D37, 0x97DD6AD4, 0x5B776A4A, 0x51B26353, 0x9D1863CD, 0x1397642E, 0xDF3D64B0, 0x83D02561,
0x4F7A25FF, 0xC1F5221C, 0x0D5F2282, 0x079A2B9B, 0xCB302B05, 0x45BF2CE6, 0x89152C78, 0x50353ED4, 0x9C9F3E4A,
0x121039A9, 0xDEBA3937, 0xD47F302E, 0x18D530B0, 0x965A3753, 0x5AF037CD, 0xFF6B144A, 0x33C114D4, 0xBD4E1337,
0x71E413A9, 0x7B211AB0, 0xB78B1A2E, 0x39041DCD, 0xF5AE1D53, 0x2C8E0FFF, 0xE0240F61, 0x6EAB0882, 0xA201081C,
0xA8C40105, 0x646E019B, 0xEAE10678, 0x264B06E6
}
};
[
[
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
],
[
0x00000000, 0x191B3141, 0x32366282, 0x2B2D53C3, 0x646CC504, 0x7D77F445, 0x565AA786, 0x4F4196C7,
0xC8D98A08, 0xD1C2BB49, 0xFAEFE88A, 0xE3F4D9CB, 0xACB54F0C, 0xB5AE7E4D, 0x9E832D8E, 0x87981CCF,
0x4AC21251, 0x53D92310, 0x78F470D3, 0x61EF4192, 0x2EAED755, 0x37B5E614, 0x1C98B5D7, 0x05838496,
0x821B9859, 0x9B00A918, 0xB02DFADB, 0xA936CB9A, 0xE6775D5D, 0xFF6C6C1C, 0xD4413FDF, 0xCD5A0E9E,
0x958424A2, 0x8C9F15E3, 0xA7B24620, 0xBEA97761, 0xF1E8E1A6, 0xE8F3D0E7, 0xC3DE8324, 0xDAC5B265,
0x5D5DAEAA, 0x44469FEB, 0x6F6BCC28, 0x7670FD69, 0x39316BAE, 0x202A5AEF, 0x0B07092C, 0x121C386D,
0xDF4636F3, 0xC65D07B2, 0xED705471, 0xF46B6530, 0xBB2AF3F7, 0xA231C2B6, 0x891C9175, 0x9007A034,
0x179FBCFB, 0x0E848DBA, 0x25A9DE79, 0x3CB2EF38, 0x73F379FF, 0x6AE848BE, 0x41C51B7D, 0x58DE2A3C,
0xF0794F05, 0xE9627E44, 0xC24F2D87, 0xDB541CC6, 0x94158A01, 0x8D0EBB40, 0xA623E883, 0xBF38D9C2,
0x38A0C50D, 0x21BBF44C, 0x0A96A78F, 0x138D96CE, 0x5CCC0009, 0x45D73148, 0x6EFA628B, 0x77E153CA,
0xBABB5D54, 0xA3A06C15, 0x888D3FD6, 0x91960E97, 0xDED79850, 0xC7CCA911, 0xECE1FAD2, 0xF5FACB93,
0x7262D75C, 0x6B79E61D, 0x4054B5DE, 0x594F849F, 0x160E1258, 0x0F152319, 0x243870DA, 0x3D23419B,
0x65FD6BA7, 0x7CE65AE6, 0x57CB0925, 0x4ED03864, 0x0191AEA3, 0x188A9FE2, 0x33A7CC21, 0x2ABCFD60,
0xAD24E1AF, 0xB43FD0EE, 0x9F12832D, 0x8609B26C, 0xC94824AB, 0xD05315EA, 0xFB7E4629, 0xE2657768,
0x2F3F79F6, 0x362448B7, 0x1D091B74, 0x04122A35, 0x4B53BCF2, 0x52488DB3, 0x7965DE70, 0x607EEF31,
0xE7E6F3FE, 0xFEFDC2BF, 0xD5D0917C, 0xCCCBA03D, 0x838A36FA, 0x9A9107BB, 0xB1BC5478, 0xA8A76539,
0x3B83984B, 0x2298A90A, 0x09B5FAC9, 0x10AECB88, 0x5FEF5D4F, 0x46F46C0E, 0x6DD93FCD, 0x74C20E8C,
0xF35A1243, 0xEA412302, 0xC16C70C1, 0xD8774180, 0x9736D747, 0x8E2DE606, 0xA500B5C5, 0xBC1B8484,
0x71418A1A, 0x685ABB5B, 0x4377E898, 0x5A6CD9D9, 0x152D4F1E, 0x0C367E5F, 0x271B2D9C, 0x3E001CDD,
0xB9980012, 0xA0833153, 0x8BAE6290, 0x92B553D1, 0xDDF4C516, 0xC4EFF457, 0xEFC2A794, 0xF6D996D5,
0xAE07BCE9, 0xB71C8DA8, 0x9C31DE6B, 0x852AEF2A, 0xCA6B79ED, 0xD37048AC, 0xF85D1B6F, 0xE1462A2E,
0x66DE36E1, 0x7FC507A0, 0x54E85463, 0x4DF36522, 0x02B2F3E5, 0x1BA9C2A4, 0x30849167, 0x299FA026,
0xE4C5AEB8, 0xFDDE9FF9, 0xD6F3CC3A, 0xCFE8FD7B, 0x80A96BBC, 0x99B25AFD, 0xB29F093E, 0xAB84387F,
0x2C1C24B0, 0x350715F1, 0x1E2A4632, 0x07317773, 0x4870E1B4, 0x516BD0F5, 0x7A468336, 0x635DB277,
0xCBFAD74E, 0xD2E1E60F, 0xF9CCB5CC, 0xE0D7848D, 0xAF96124A, 0xB68D230B, 0x9DA070C8, 0x84BB4189,
0x03235D46, 0x1A386C07, 0x31153FC4, 0x280E0E85, 0x674F9842, 0x7E54A903, 0x5579FAC0, 0x4C62CB81,
0x8138C51F, 0x9823F45E, 0xB30EA79D, 0xAA1596DC, 0xE554001B, 0xFC4F315A, 0xD7626299, 0xCE7953D8,
0x49E14F17, 0x50FA7E56, 0x7BD72D95, 0x62CC1CD4, 0x2D8D8A13, 0x3496BB52, 0x1FBBE891, 0x06A0D9D0,
0x5E7EF3EC, 0x4765C2AD, 0x6C48916E, 0x7553A02F, 0x3A1236E8, 0x230907A9, 0x0824546A, 0x113F652B,
0x96A779E4, 0x8FBC48A5, 0xA4911B66, 0xBD8A2A27, 0xF2CBBCE0, 0xEBD08DA1, 0xC0FDDE62, 0xD9E6EF23,
0x14BCE1BD, 0x0DA7D0FC, 0x268A833F, 0x3F91B27E, 0x70D024B9, 0x69CB15F8, 0x42E6463B, 0x5BFD777A,
0xDC656BB5, 0xC57E5AF4, 0xEE530937, 0xF7483876, 0xB809AEB1, 0xA1129FF0, 0x8A3FCC33, 0x9324FD72
],
[
0x00000000, 0x01C26A37, 0x0384D46E, 0x0246BE59, 0x0709A8DC, 0x06CBC2EB, 0x048D7CB2, 0x054F1685,
0x0E1351B8, 0x0FD13B8F, 0x0D9785D6, 0x0C55EFE1, 0x091AF964, 0x08D89353, 0x0A9E2D0A, 0x0B5C473D,
0x1C26A370, 0x1DE4C947, 0x1FA2771E, 0x1E601D29, 0x1B2F0BAC, 0x1AED619B, 0x18ABDFC2, 0x1969B5F5,
0x1235F2C8, 0x13F798FF, 0x11B126A6, 0x10734C91, 0x153C5A14, 0x14FE3023, 0x16B88E7A, 0x177AE44D,
0x384D46E0, 0x398F2CD7, 0x3BC9928E, 0x3A0BF8B9, 0x3F44EE3C, 0x3E86840B, 0x3CC03A52, 0x3D025065,
0x365E1758, 0x379C7D6F, 0x35DAC336, 0x3418A901, 0x3157BF84, 0x3095D5B3, 0x32D36BEA, 0x331101DD,
0x246BE590, 0x25A98FA7, 0x27EF31FE, 0x262D5BC9, 0x23624D4C, 0x22A0277B, 0x20E69922, 0x2124F315,
0x2A78B428, 0x2BBADE1F, 0x29FC6046, 0x283E0A71, 0x2D711CF4, 0x2CB376C3, 0x2EF5C89A, 0x2F37A2AD,
0x709A8DC0, 0x7158E7F7, 0x731E59AE, 0x72DC3399, 0x7793251C, 0x76514F2B, 0x7417F172, 0x75D59B45,
0x7E89DC78, 0x7F4BB64F, 0x7D0D0816, 0x7CCF6221, 0x798074A4, 0x78421E93, 0x7A04A0CA, 0x7BC6CAFD,
0x6CBC2EB0, 0x6D7E4487, 0x6F38FADE, 0x6EFA90E9, 0x6BB5866C, 0x6A77EC5B, 0x68315202, 0x69F33835,
0x62AF7F08, 0x636D153F, 0x612BAB66, 0x60E9C151, 0x65A6D7D4, 0x6464BDE3, 0x662203BA, 0x67E0698D,
0x48D7CB20, 0x4915A117, 0x4B531F4E, 0x4A917579, 0x4FDE63FC, 0x4E1C09CB, 0x4C5AB792, 0x4D98DDA5,
0x46C49A98, 0x4706F0AF, 0x45404EF6, 0x448224C1, 0x41CD3244, 0x400F5873, 0x4249E62A, 0x438B8C1D,
0x54F16850, 0x55330267, 0x5775BC3E, 0x56B7D609, 0x53F8C08C, 0x523AAABB, 0x507C14E2, 0x51BE7ED5,
0x5AE239E8, 0x5B2053DF, 0x5966ED86, 0x58A487B1, 0x5DEB9134, 0x5C29FB03, 0x5E6F455A, 0x5FAD2F6D,
0xE1351B80, 0xE0F771B7, 0xE2B1CFEE, 0xE373A5D9, 0xE63CB35C, 0xE7FED96B, 0xE5B86732, 0xE47A0D05,
0xEF264A38, 0xEEE4200F, 0xECA29E56, 0xED60F461, 0xE82FE2E4, 0xE9ED88D3, 0xEBAB368A, 0xEA695CBD,
0xFD13B8F0, 0xFCD1D2C7, 0xFE976C9E, 0xFF5506A9, 0xFA1A102C, 0xFBD87A1B, 0xF99EC442, 0xF85CAE75,
0xF300E948, 0xF2C2837F, 0xF0843D26, 0xF1465711, 0xF4094194, 0xF5CB2BA3, 0xF78D95FA, 0xF64FFFCD,
0xD9785D60, 0xD8BA3757, 0xDAFC890E, 0xDB3EE339, 0xDE71F5BC, 0xDFB39F8B, 0xDDF521D2, 0xDC374BE5,
0xD76B0CD8, 0xD6A966EF, 0xD4EFD8B6, 0xD52DB281, 0xD062A404, 0xD1A0CE33, 0xD3E6706A, 0xD2241A5D,
0xC55EFE10, 0xC49C9427, 0xC6DA2A7E, 0xC7184049, 0xC25756CC, 0xC3953CFB, 0xC1D382A2, 0xC011E895,
0xCB4DAFA8, 0xCA8FC59F, 0xC8C97BC6, 0xC90B11F1, 0xCC440774, 0xCD866D43, 0xCFC0D31A, 0xCE02B92D,
0x91AF9640, 0x906DFC77, 0x922B422E, 0x93E92819, 0x96A63E9C, 0x976454AB, 0x9522EAF2, 0x94E080C5,
0x9FBCC7F8, 0x9E7EADCF, 0x9C381396, 0x9DFA79A1, 0x98B56F24, 0x99770513, 0x9B31BB4A, 0x9AF3D17D,
0x8D893530, 0x8C4B5F07, 0x8E0DE15E, 0x8FCF8B69, 0x8A809DEC, 0x8B42F7DB, 0x89044982, 0x88C623B5,
0x839A6488, 0x82580EBF, 0x801EB0E6, 0x81DCDAD1, 0x8493CC54, 0x8551A663, 0x8717183A, 0x86D5720D,
0xA9E2D0A0, 0xA820BA97, 0xAA6604CE, 0xABA46EF9, 0xAEEB787C, 0xAF29124B, 0xAD6FAC12, 0xACADC625,
0xA7F18118, 0xA633EB2F, 0xA4755576, 0xA5B73F41, 0xA0F829C4, 0xA13A43F3, 0xA37CFDAA, 0xA2BE979D,
0xB5C473D0, 0xB40619E7, 0xB640A7BE, 0xB782CD89, 0xB2CDDB0C, 0xB30FB13B, 0xB1490F62, 0xB08B6555,
0xBBD72268, 0xBA15485F, 0xB853F606, 0xB9919C31, 0xBCDE8AB4, 0xBD1CE083, 0xBF5A5EDA, 0xBE9834ED
],
[
0x00000000, 0xB8BC6765, 0xAA09C88B, 0x12B5AFEE, 0x8F629757, 0x37DEF032, 0x256B5FDC, 0x9DD738B9,
0xC5B428EF, 0x7D084F8A, 0x6FBDE064, 0xD7018701, 0x4AD6BFB8, 0xF26AD8DD, 0xE0DF7733, 0x58631056,
0x5019579F, 0xE8A530FA, 0xFA109F14, 0x42ACF871, 0xDF7BC0C8, 0x67C7A7AD, 0x75720843, 0xCDCE6F26,
0x95AD7F70, 0x2D111815, 0x3FA4B7FB, 0x8718D09E, 0x1ACFE827, 0xA2738F42, 0xB0C620AC, 0x087A47C9,
0xA032AF3E, 0x188EC85B, 0x0A3B67B5, 0xB28700D0, 0x2F503869, 0x97EC5F0C, 0x8559F0E2, 0x3DE59787,
0x658687D1, 0xDD3AE0B4, 0xCF8F4F5A, 0x7733283F, 0xEAE41086, 0x525877E3, 0x40EDD80D, 0xF851BF68,
0xF02BF8A1, 0x48979FC4, 0x5A22302A, 0xE29E574F, 0x7F496FF6, 0xC7F50893, 0xD540A77D, 0x6DFCC018,
0x359FD04E, 0x8D23B72B, 0x9F9618C5, 0x272A7FA0, 0xBAFD4719, 0x0241207C, 0x10F48F92, 0xA848E8F7,
0x9B14583D, 0x23A83F58, 0x311D90B6, 0x89A1F7D3, 0x1476CF6A, 0xACCAA80F, 0xBE7F07E1, 0x06C36084,
0x5EA070D2, 0xE61C17B7, 0xF4A9B859, 0x4C15DF3C, 0xD1C2E785, 0x697E80E0, 0x7BCB2F0E, 0xC377486B,
0xCB0D0FA2, 0x73B168C7, 0x6104C729, 0xD9B8A04C, 0x446F98F5, 0xFCD3FF90, 0xEE66507E, 0x56DA371B,
0x0EB9274D, 0xB6054028, 0xA4B0EFC6, 0x1C0C88A3, 0x81DBB01A, 0x3967D77F, 0x2BD27891, 0x936E1FF4,
0x3B26F703, 0x839A9066, 0x912F3F88, 0x299358ED, 0xB4446054, 0x0CF80731, 0x1E4DA8DF, 0xA6F1CFBA,
0xFE92DFEC, 0x462EB889, 0x549B1767, 0xEC277002, 0x71F048BB, 0xC94C2FDE, 0xDBF98030, 0x6345E755,
0x6B3FA09C, 0xD383C7F9, 0xC1366817, 0x798A0F72, 0xE45D37CB, 0x5CE150AE, 0x4E54FF40, 0xF6E89825,
0xAE8B8873, 0x1637EF16, 0x048240F8, 0xBC3E279D, 0x21E91F24, 0x99557841, 0x8BE0D7AF, 0x335CB0CA,
0xED59B63B, 0x55E5D15E, 0x47507EB0, 0xFFEC19D5, 0x623B216C, 0xDA874609, 0xC832E9E7, 0x708E8E82,
0x28ED9ED4, 0x9051F9B1, 0x82E4565F, 0x3A58313A, 0xA78F0983, 0x1F336EE6, 0x0D86C108, 0xB53AA66D,
0xBD40E1A4, 0x05FC86C1, 0x1749292F, 0xAFF54E4A, 0x322276F3, 0x8A9E1196, 0x982BBE78, 0x2097D91D,
0x78F4C94B, 0xC048AE2E, 0xD2FD01C0, 0x6A4166A5, 0xF7965E1C, 0x4F2A3979, 0x5D9F9697, 0xE523F1F2,
0x4D6B1905, 0xF5D77E60, 0xE762D18E, 0x5FDEB6EB, 0xC2098E52, 0x7AB5E937, 0x680046D9, 0xD0BC21BC,
0x88DF31EA, 0x3063568F, 0x22D6F961, 0x9A6A9E04, 0x07BDA6BD, 0xBF01C1D8, 0xADB46E36, 0x15080953,
0x1D724E9A, 0xA5CE29FF, 0xB77B8611, 0x0FC7E174, 0x9210D9CD, 0x2AACBEA8, 0x38191146, 0x80A57623,
0xD8C66675, 0x607A0110, 0x72CFAEFE, 0xCA73C99B, 0x57A4F122, 0xEF189647, 0xFDAD39A9, 0x45115ECC,
0x764DEE06, 0xCEF18963, 0xDC44268D, 0x64F841E8, 0xF92F7951, 0x41931E34, 0x5326B1DA, 0xEB9AD6BF,
0xB3F9C6E9, 0x0B45A18C, 0x19F00E62, 0xA14C6907, 0x3C9B51BE, 0x842736DB, 0x96929935, 0x2E2EFE50,
0x2654B999, 0x9EE8DEFC, 0x8C5D7112, 0x34E11677, 0xA9362ECE, 0x118A49AB, 0x033FE645, 0xBB838120,
0xE3E09176, 0x5B5CF613, 0x49E959FD, 0xF1553E98, 0x6C820621, 0xD43E6144, 0xC68BCEAA, 0x7E37A9CF,
0xD67F4138, 0x6EC3265D, 0x7C7689B3, 0xC4CAEED6, 0x591DD66F, 0xE1A1B10A, 0xF3141EE4, 0x4BA87981,
0x13CB69D7, 0xAB770EB2, 0xB9C2A15C, 0x017EC639, 0x9CA9FE80, 0x241599E5, 0x36A0360B, 0x8E1C516E,
0x866616A7, 0x3EDA71C2, 0x2C6FDE2C, 0x94D3B949, 0x090481F0, 0xB1B8E695, 0xA30D497B, 0x1BB12E1E,
0x43D23E48, 0xFB6E592D, 0xE9DBF6C3, 0x516791A6, 0xCCB0A91F, 0x740CCE7A, 0x66B96194, 0xDE0506F1
],
[
0x00000000, 0x3D6029B0, 0x7AC05360, 0x47A07AD0, 0xF580A6C0, 0xC8E08F70, 0x8F40F5A0, 0xB220DC10,
0x30704BC1, 0x0D106271, 0x4AB018A1, 0x77D03111, 0xC5F0ED01, 0xF890C4B1, 0xBF30BE61, 0x825097D1,
0x60E09782, 0x5D80BE32, 0x1A20C4E2, 0x2740ED52, 0x95603142, 0xA80018F2, 0xEFA06222, 0xD2C04B92,
0x5090DC43, 0x6DF0F5F3, 0x2A508F23, 0x1730A693, 0xA5107A83, 0x98705333, 0xDFD029E3, 0xE2B00053,
0xC1C12F04, 0xFCA106B4, 0xBB017C64, 0x866155D4, 0x344189C4, 0x0921A074, 0x4E81DAA4, 0x73E1F314,
0xF1B164C5, 0xCCD14D75, 0x8B7137A5, 0xB6111E15, 0x0431C205, 0x3951EBB5, 0x7EF19165, 0x4391B8D5,
0xA121B886, 0x9C419136, 0xDBE1EBE6, 0xE681C256, 0x54A11E46, 0x69C137F6, 0x2E614D26, 0x13016496,
0x9151F347, 0xAC31DAF7, 0xEB91A027, 0xD6F18997, 0x64D15587, 0x59B17C37, 0x1E1106E7, 0x23712F57,
0x58F35849, 0x659371F9, 0x22330B29, 0x1F532299, 0xAD73FE89, 0x9013D739, 0xD7B3ADE9, 0xEAD38459,
0x68831388, 0x55E33A38, 0x124340E8, 0x2F236958, 0x9D03B548, 0xA0639CF8, 0xE7C3E628, 0xDAA3CF98,
0x3813CFCB, 0x0573E67B, 0x42D39CAB, 0x7FB3B51B, 0xCD93690B, 0xF0F340BB, 0xB7533A6B, 0x8A3313DB,
0x0863840A, 0x3503ADBA, 0x72A3D76A, 0x4FC3FEDA, 0xFDE322CA, 0xC0830B7A, 0x872371AA, 0xBA43581A,
0x9932774D, 0xA4525EFD, 0xE3F2242D, 0xDE920D9D, 0x6CB2D18D, 0x51D2F83D, 0x167282ED, 0x2B12AB5D,
0xA9423C8C, 0x9422153C, 0xD3826FEC, 0xEEE2465C, 0x5CC29A4C, 0x61A2B3FC, 0x2602C92C, 0x1B62E09C,
0xF9D2E0CF, 0xC4B2C97F, 0x8312B3AF, 0xBE729A1F, 0x0C52460F, 0x31326FBF, 0x7692156F, 0x4BF23CDF,
0xC9A2AB0E, 0xF4C282BE, 0xB362F86E, 0x8E02D1DE, 0x3C220DCE, 0x0142247E, 0x46E25EAE, 0x7B82771E,
0xB1E6B092, 0x8C869922, 0xCB26E3F2, 0xF646CA42, 0x44661652, 0x79063FE2, 0x3EA64532, 0x03C66C82,
0x8196FB53, 0xBCF6D2E3, 0xFB56A833, 0xC6368183, 0x74165D93, 0x49767423, 0x0ED60EF3, 0x33B62743,
0xD1062710, 0xEC660EA0, 0xABC67470, 0x96A65DC0, 0x248681D0, 0x19E6A860, 0x5E46D2B0, 0x6326FB00,
0xE1766CD1, 0xDC164561, 0x9BB63FB1, 0xA6D61601, 0x14F6CA11, 0x2996E3A1, 0x6E369971, 0x5356B0C1,
0x70279F96, 0x4D47B626, 0x0AE7CCF6, 0x3787E546, 0x85A73956, 0xB8C710E6, 0xFF676A36, 0xC2074386,
0x4057D457, 0x7D37FDE7, 0x3A978737, 0x07F7AE87, 0xB5D77297, 0x88B75B27, 0xCF1721F7, 0xF2770847,
0x10C70814, 0x2DA721A4, 0x6A075B74, 0x576772C4, 0xE547AED4, 0xD8278764, 0x9F87FDB4, 0xA2E7D404,
0x20B743D5, 0x1DD76A65, 0x5A7710B5, 0x67173905, 0xD537E515, 0xE857CCA5, 0xAFF7B675, 0x92979FC5,
0xE915E8DB, 0xD475C16B, 0x93D5BBBB, 0xAEB5920B, 0x1C954E1B, 0x21F567AB, 0x66551D7B, 0x5B3534CB,
0xD965A31A, 0xE4058AAA, 0xA3A5F07A, 0x9EC5D9CA, 0x2CE505DA, 0x11852C6A, 0x562556BA, 0x6B457F0A,
0x89F57F59, 0xB49556E9, 0xF3352C39, 0xCE550589, 0x7C75D999, 0x4115F029, 0x06B58AF9, 0x3BD5A349,
0xB9853498, 0x84E51D28, 0xC34567F8, 0xFE254E48, 0x4C059258, 0x7165BBE8, 0x36C5C138, 0x0BA5E888,
0x28D4C7DF, 0x15B4EE6F, 0x521494BF, 0x6F74BD0F, 0xDD54611F, 0xE03448AF, 0xA794327F, 0x9AF41BCF,
0x18A48C1E, 0x25C4A5AE, 0x6264DF7E, 0x5F04F6CE, 0xED242ADE, 0xD044036E, 0x97E479BE, 0xAA84500E,
0x4834505D, 0x755479ED, 0x32F4033D, 0x0F942A8D, 0xBDB4F69D, 0x80D4DF2D, 0xC774A5FD, 0xFA148C4D,
0x78441B9C, 0x4524322C, 0x028448FC, 0x3FE4614C, 0x8DC4BD5C, 0xB0A494EC, 0xF704EE3C, 0xCA64C78C
],
[
0x00000000, 0xCB5CD3A5, 0x4DC8A10B, 0x869472AE, 0x9B914216, 0x50CD91B3, 0xD659E31D, 0x1D0530B8,
0xEC53826D, 0x270F51C8, 0xA19B2366, 0x6AC7F0C3, 0x77C2C07B, 0xBC9E13DE, 0x3A0A6170, 0xF156B2D5,
0x03D6029B, 0xC88AD13E, 0x4E1EA390, 0x85427035, 0x9847408D, 0x531B9328, 0xD58FE186, 0x1ED33223,
0xEF8580F6, 0x24D95353, 0xA24D21FD, 0x6911F258, 0x7414C2E0, 0xBF481145, 0x39DC63EB, 0xF280B04E,
0x07AC0536, 0xCCF0D693, 0x4A64A43D, 0x81387798, 0x9C3D4720, 0x57619485, 0xD1F5E62B, 0x1AA9358E,
0xEBFF875B, 0x20A354FE, 0xA6372650, 0x6D6BF5F5, 0x706EC54D, 0xBB3216E8, 0x3DA66446, 0xF6FAB7E3,
0x047A07AD, 0xCF26D408, 0x49B2A6A6, 0x82EE7503, 0x9FEB45BB, 0x54B7961E, 0xD223E4B0, 0x197F3715,
0xE82985C0, 0x23755665, 0xA5E124CB, 0x6EBDF76E, 0x73B8C7D6, 0xB8E41473, 0x3E7066DD, 0xF52CB578,
0x0F580A6C, 0xC404D9C9, 0x4290AB67, 0x89CC78C2, 0x94C9487A, 0x5F959BDF, 0xD901E971, 0x125D3AD4,
0xE30B8801, 0x28575BA4, 0xAEC3290A, 0x659FFAAF, 0x789ACA17, 0xB3C619B2, 0x35526B1C, 0xFE0EB8B9,
0x0C8E08F7, 0xC7D2DB52, 0x4146A9FC, 0x8A1A7A59, 0x971F4AE1, 0x5C439944, 0xDAD7EBEA, 0x118B384F,
0xE0DD8A9A, 0x2B81593F, 0xAD152B91, 0x6649F834, 0x7B4CC88C, 0xB0101B29, 0x36846987, 0xFDD8BA22,
0x08F40F5A, 0xC3A8DCFF, 0x453CAE51, 0x8E607DF4, 0x93654D4C, 0x58399EE9, 0xDEADEC47, 0x15F13FE2,
0xE4A78D37, 0x2FFB5E92, 0xA96F2C3C, 0x6233FF99, 0x7F36CF21, 0xB46A1C84, 0x32FE6E2A, 0xF9A2BD8F,
0x0B220DC1, 0xC07EDE64, 0x46EAACCA, 0x8DB67F6F, 0x90B34FD7, 0x5BEF9C72, 0xDD7BEEDC, 0x16273D79,
0xE7718FAC, 0x2C2D5C09, 0xAAB92EA7, 0x61E5FD02, 0x7CE0CDBA, 0xB7BC1E1F, 0x31286CB1, 0xFA74BF14,
0x1EB014D8, 0xD5ECC77D, 0x5378B5D3, 0x98246676, 0x852156CE, 0x4E7D856B, 0xC8E9F7C5, 0x03B52460,
0xF2E396B5, 0x39BF4510, 0xBF2B37BE, 0x7477E41B, 0x6972D4A3, 0xA22E0706, 0x24BA75A8, 0xEFE6A60D,
0x1D661643, 0xD63AC5E6, 0x50AEB748, 0x9BF264ED, 0x86F75455, 0x4DAB87F0, 0xCB3FF55E, 0x006326FB,
0xF135942E, 0x3A69478B, 0xBCFD3525, 0x77A1E680, 0x6AA4D638, 0xA1F8059D, 0x276C7733, 0xEC30A496,
0x191C11EE, 0xD240C24B, 0x54D4B0E5, 0x9F886340, 0x828D53F8, 0x49D1805D, 0xCF45F2F3, 0x04192156,
0xF54F9383, 0x3E134026, 0xB8873288, 0x73DBE12D, 0x6EDED195, 0xA5820230, 0x2316709E, 0xE84AA33B,
0x1ACA1375, 0xD196C0D0, 0x5702B27E, 0x9C5E61DB, 0x815B5163, 0x4A0782C6, 0xCC93F068, 0x07CF23CD,
0xF6999118, 0x3DC542BD, 0xBB513013, 0x700DE3B6, 0x6D08D30E, 0xA65400AB, 0x20C07205, 0xEB9CA1A0,
0x11E81EB4, 0xDAB4CD11, 0x5C20BFBF, 0x977C6C1A, 0x8A795CA2, 0x41258F07, 0xC7B1FDA9, 0x0CED2E0C,
0xFDBB9CD9, 0x36E74F7C, 0xB0733DD2, 0x7B2FEE77, 0x662ADECF, 0xAD760D6A, 0x2BE27FC4, 0xE0BEAC61,
0x123E1C2F, 0xD962CF8A, 0x5FF6BD24, 0x94AA6E81, 0x89AF5E39, 0x42F38D9C, 0xC467FF32, 0x0F3B2C97,
0xFE6D9E42, 0x35314DE7, 0xB3A53F49, 0x78F9ECEC, 0x65FCDC54, 0xAEA00FF1, 0x28347D5F, 0xE368AEFA,
0x16441B82, 0xDD18C827, 0x5B8CBA89, 0x90D0692C, 0x8DD55994, 0x46898A31, 0xC01DF89F, 0x0B412B3A,
0xFA1799EF, 0x314B4A4A, 0xB7DF38E4, 0x7C83EB41, 0x6186DBF9, 0xAADA085C, 0x2C4E7AF2, 0xE712A957,
0x15921919, 0xDECECABC, 0x585AB812, 0x93066BB7, 0x8E035B0F, 0x455F88AA, 0xC3CBFA04, 0x089729A1,
0xF9C19B74, 0x329D48D1, 0xB4093A7F, 0x7F55E9DA, 0x6250D962, 0xA90C0AC7, 0x2F987869, 0xE4C4ABCC
],
[
0x00000000, 0xA6770BB4, 0x979F1129, 0x31E81A9D, 0xF44F2413, 0x52382FA7, 0x63D0353A, 0xC5A73E8E,
0x33EF4E67, 0x959845D3, 0xA4705F4E, 0x020754FA, 0xC7A06A74, 0x61D761C0, 0x503F7B5D, 0xF64870E9,
0x67DE9CCE, 0xC1A9977A, 0xF0418DE7, 0x56368653, 0x9391B8DD, 0x35E6B369, 0x040EA9F4, 0xA279A240,
0x5431D2A9, 0xF246D91D, 0xC3AEC380, 0x65D9C834, 0xA07EF6BA, 0x0609FD0E, 0x37E1E793, 0x9196EC27,
0xCFBD399C, 0x69CA3228, 0x582228B5, 0xFE552301, 0x3BF21D8F, 0x9D85163B, 0xAC6D0CA6, 0x0A1A0712,
0xFC5277FB, 0x5A257C4F, 0x6BCD66D2, 0xCDBA6D66, 0x081D53E8, 0xAE6A585C, 0x9F8242C1, 0x39F54975,
0xA863A552, 0x0E14AEE6, 0x3FFCB47B, 0x998BBFCF, 0x5C2C8141, 0xFA5B8AF5, 0xCBB39068, 0x6DC49BDC,
0x9B8CEB35, 0x3DFBE081, 0x0C13FA1C, 0xAA64F1A8, 0x6FC3CF26, 0xC9B4C492, 0xF85CDE0F, 0x5E2BD5BB,
0x440B7579, 0xE27C7ECD, 0xD3946450, 0x75E36FE4, 0xB044516A, 0x16335ADE, 0x27DB4043, 0x81AC4BF7,
0x77E43B1E, 0xD19330AA, 0xE07B2A37, 0x460C2183, 0x83AB1F0D, 0x25DC14B9, 0x14340E24, 0xB2430590,
0x23D5E9B7, 0x85A2E203, 0xB44AF89E, 0x123DF32A, 0xD79ACDA4, 0x71EDC610, 0x4005DC8D, 0xE672D739,
0x103AA7D0, 0xB64DAC64, 0x87A5B6F9, 0x21D2BD4D, 0xE47583C3, 0x42028877, 0x73EA92EA, 0xD59D995E,
0x8BB64CE5, 0x2DC14751, 0x1C295DCC, 0xBA5E5678, 0x7FF968F6, 0xD98E6342, 0xE86679DF, 0x4E11726B,
0xB8590282, 0x1E2E0936, 0x2FC613AB, 0x89B1181F, 0x4C162691, 0xEA612D25, 0xDB8937B8, 0x7DFE3C0C,
0xEC68D02B, 0x4A1FDB9F, 0x7BF7C102, 0xDD80CAB6, 0x1827F438, 0xBE50FF8C, 0x8FB8E511, 0x29CFEEA5,
0xDF879E4C, 0x79F095F8, 0x48188F65, 0xEE6F84D1, 0x2BC8BA5F, 0x8DBFB1EB, 0xBC57AB76, 0x1A20A0C2,
0x8816EAF2, 0x2E61E146, 0x1F89FBDB, 0xB9FEF06F, 0x7C59CEE1, 0xDA2EC555, 0xEBC6DFC8, 0x4DB1D47C,
0xBBF9A495, 0x1D8EAF21, 0x2C66B5BC, 0x8A11BE08, 0x4FB68086, 0xE9C18B32, 0xD82991AF, 0x7E5E9A1B,
0xEFC8763C, 0x49BF7D88, 0x78576715, 0xDE206CA1, 0x1B87522F, 0xBDF0599B, 0x8C184306, 0x2A6F48B2,
0xDC27385B, 0x7A5033EF, 0x4BB82972, 0xEDCF22C6, 0x28681C48, 0x8E1F17FC, 0xBFF70D61, 0x198006D5,
0x47ABD36E, 0xE1DCD8DA, 0xD034C247, 0x7643C9F3, 0xB3E4F77D, 0x1593FCC9, 0x247BE654, 0x820CEDE0,
0x74449D09, 0xD23396BD, 0xE3DB8C20, 0x45AC8794, 0x800BB91A, 0x267CB2AE, 0x1794A833, 0xB1E3A387,
0x20754FA0, 0x86024414, 0xB7EA5E89, 0x119D553D, 0xD43A6BB3, 0x724D6007, 0x43A57A9A, 0xE5D2712E,
0x139A01C7, 0xB5ED0A73, 0x840510EE, 0x22721B5A, 0xE7D525D4, 0x41A22E60, 0x704A34FD, 0xD63D3F49,
0xCC1D9F8B, 0x6A6A943F, 0x5B828EA2, 0xFDF58516, 0x3852BB98, 0x9E25B02C, 0xAFCDAAB1, 0x09BAA105,
0xFFF2D1EC, 0x5985DA58, 0x686DC0C5, 0xCE1ACB71, 0x0BBDF5FF, 0xADCAFE4B, 0x9C22E4D6, 0x3A55EF62,
0xABC30345, 0x0DB408F1, 0x3C5C126C, 0x9A2B19D8, 0x5F8C2756, 0xF9FB2CE2, 0xC813367F, 0x6E643DCB,
0x982C4D22, 0x3E5B4696, 0x0FB35C0B, 0xA9C457BF, 0x6C636931, 0xCA146285, 0xFBFC7818, 0x5D8B73AC,
0x03A0A617, 0xA5D7ADA3, 0x943FB73E, 0x3248BC8A, 0xF7EF8204, 0x519889B0, 0x6070932D, 0xC6079899,
0x304FE870, 0x9638E3C4, 0xA7D0F959, 0x01A7F2ED, 0xC400CC63, 0x6277C7D7, 0x539FDD4A, 0xF5E8D6FE,
0x647E3AD9, 0xC209316D, 0xF3E12BF0, 0x55962044, 0x90311ECA, 0x3646157E, 0x07AE0FE3, 0xA1D90457,
0x579174BE, 0xF1E67F0A, 0xC00E6597, 0x66796E23, 0xA3DE50AD, 0x05A95B19, 0x34414184, 0x92364A30
],
[
0x00000000, 0xCCAA009E, 0x4225077D, 0x8E8F07E3, 0x844A0EFA, 0x48E00E64, 0xC66F0987, 0x0AC50919,
0xD3E51BB5, 0x1F4F1B2B, 0x91C01CC8, 0x5D6A1C56, 0x57AF154F, 0x9B0515D1, 0x158A1232, 0xD92012AC,
0x7CBB312B, 0xB01131B5, 0x3E9E3656, 0xF23436C8, 0xF8F13FD1, 0x345B3F4F, 0xBAD438AC, 0x767E3832,
0xAF5E2A9E, 0x63F42A00, 0xED7B2DE3, 0x21D12D7D, 0x2B142464, 0xE7BE24FA, 0x69312319, 0xA59B2387,
0xF9766256, 0x35DC62C8, 0xBB53652B, 0x77F965B5, 0x7D3C6CAC, 0xB1966C32, 0x3F196BD1, 0xF3B36B4F,
0x2A9379E3, 0xE639797D, 0x68B67E9E, 0xA41C7E00, 0xAED97719, 0x62737787, 0xECFC7064, 0x205670FA,
0x85CD537D, 0x496753E3, 0xC7E85400, 0x0B42549E, 0x01875D87, 0xCD2D5D19, 0x43A25AFA, 0x8F085A64,
0x562848C8, 0x9A824856, 0x140D4FB5, 0xD8A74F2B, 0xD2624632, 0x1EC846AC, 0x9047414F, 0x5CED41D1,
0x299DC2ED, 0xE537C273, 0x6BB8C590, 0xA712C50E, 0xADD7CC17, 0x617DCC89, 0xEFF2CB6A, 0x2358CBF4,
0xFA78D958, 0x36D2D9C6, 0xB85DDE25, 0x74F7DEBB, 0x7E32D7A2, 0xB298D73C, 0x3C17D0DF, 0xF0BDD041,
0x5526F3C6, 0x998CF358, 0x1703F4BB, 0xDBA9F425, 0xD16CFD3C, 0x1DC6FDA2, 0x9349FA41, 0x5FE3FADF,
0x86C3E873, 0x4A69E8ED, 0xC4E6EF0E, 0x084CEF90, 0x0289E689, 0xCE23E617, 0x40ACE1F4, 0x8C06E16A,
0xD0EBA0BB, 0x1C41A025, 0x92CEA7C6, 0x5E64A758, 0x54A1AE41, 0x980BAEDF, 0x1684A93C, 0xDA2EA9A2,
0x030EBB0E, 0xCFA4BB90, 0x412BBC73, 0x8D81BCED, 0x8744B5F4, 0x4BEEB56A, 0xC561B289, 0x09CBB217,
0xAC509190, 0x60FA910E, 0xEE7596ED, 0x22DF9673, 0x281A9F6A, 0xE4B09FF4, 0x6A3F9817, 0xA6959889,
0x7FB58A25, 0xB31F8ABB, 0x3D908D58, 0xF13A8DC6, 0xFBFF84DF, 0x37558441, 0xB9DA83A2, 0x7570833C,
0x533B85DA, 0x9F918544, 0x111E82A7, 0xDDB48239, 0xD7718B20, 0x1BDB8BBE, 0x95548C5D, 0x59FE8CC3,
0x80DE9E6F, 0x4C749EF1, 0xC2FB9912, 0x0E51998C, 0x04949095, 0xC83E900B, 0x46B197E8, 0x8A1B9776,
0x2F80B4F1, 0xE32AB46F, 0x6DA5B38C, 0xA10FB312, 0xABCABA0B, 0x6760BA95, 0xE9EFBD76, 0x2545BDE8,
0xFC65AF44, 0x30CFAFDA, 0xBE40A839, 0x72EAA8A7, 0x782FA1BE, 0xB485A120, 0x3A0AA6C3, 0xF6A0A65D,
0xAA4DE78C, 0x66E7E712, 0xE868E0F1, 0x24C2E06F, 0x2E07E976, 0xE2ADE9E8, 0x6C22EE0B, 0xA088EE95,
0x79A8FC39, 0xB502FCA7, 0x3B8DFB44, 0xF727FBDA, 0xFDE2F2C3, 0x3148F25D, 0xBFC7F5BE, 0x736DF520,
0xD6F6D6A7, 0x1A5CD639, 0x94D3D1DA, 0x5879D144, 0x52BCD85D, 0x9E16D8C3, 0x1099DF20, 0xDC33DFBE,
0x0513CD12, 0xC9B9CD8C, 0x4736CA6F, 0x8B9CCAF1, 0x8159C3E8, 0x4DF3C376, 0xC37CC495, 0x0FD6C40B,
0x7AA64737, 0xB60C47A9, 0x3883404A, 0xF42940D4, 0xFEEC49CD, 0x32464953, 0xBCC94EB0, 0x70634E2E,
0xA9435C82, 0x65E95C1C, 0xEB665BFF, 0x27CC5B61, 0x2D095278, 0xE1A352E6, 0x6F2C5505, 0xA386559B,
0x061D761C, 0xCAB77682, 0x44387161, 0x889271FF, 0x825778E6, 0x4EFD7878, 0xC0727F9B, 0x0CD87F05,
0xD5F86DA9, 0x19526D37, 0x97DD6AD4, 0x5B776A4A, 0x51B26353, 0x9D1863CD, 0x1397642E, 0xDF3D64B0,
0x83D02561, 0x4F7A25FF, 0xC1F5221C, 0x0D5F2282, 0x079A2B9B, 0xCB302B05, 0x45BF2CE6, 0x89152C78,
0x50353ED4, 0x9C9F3E4A, 0x121039A9, 0xDEBA3937, 0xD47F302E, 0x18D530B0, 0x965A3753, 0x5AF037CD,
0xFF6B144A, 0x33C114D4, 0xBD4E1337, 0x71E413A9, 0x7B211AB0, 0xB78B1A2E, 0x39041DCD, 0xF5AE1D53,
0x2C8E0FFF, 0xE0240F61, 0x6EAB0882, 0xA201081C, 0xA8C40105, 0x646E019B, 0xEAE10678, 0x264B06E6
]
];
readonly uint _finalSeed;
readonly IntPtr _nativeContext;

View File

@@ -31,10 +31,10 @@ namespace Aaru.Checksums.CRC64;
static class Clmul
{
static readonly byte[] _shuffleMasks =
{
[
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x8f, 0x8e,
0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80
};
];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static void ShiftRight128(Vector128<ulong> initial, uint n, out Vector128<ulong> outLeft,

View File

@@ -56,9 +56,8 @@ public sealed class Crc64Context : IChecksum
const ulong CRC64_ECMA_SEED = 0xFFFFFFFFFFFFFFFF;
static readonly ulong[][] _ecmaCrc64Table =
{
new ulong[]
{
[
[
0x0000000000000000, 0xB32E4CBE03A75F6F, 0xF4843657A840A05B, 0x47AA7AE9ABE7FF34, 0x7BD0C384FF8F5E33,
0xC8FE8F3AFC28015C, 0x8F54F5D357CFFE68, 0x3C7AB96D5468A107, 0xF7A18709FF1EBC66, 0x448FCBB7FCB9E309,
0x0325B15E575E1C3D, 0xB00BFDE054F94352, 0x8C71448D0091E255, 0x3F5F08330336BD3A, 0x78F572DAA8D1420E,
@@ -111,9 +110,8 @@ public sealed class Crc64Context : IChecksum
0xE388102D33392364, 0xA4226AC498DEDC50, 0x170C267A9B79833F, 0xDCD7181E300F9E5E, 0x6FF954A033A8C131,
0x28532E49984F3E05, 0x9B7D62F79BE8616A, 0xA707DB9ACF80C06D, 0x14299724CC279F02, 0x5383EDCD67C06036,
0xE0ADA17364673F59
},
new ulong[]
{
],
[
0x0000000000000000, 0x54E979925CD0F10D, 0xA9D2F324B9A1E21A, 0xFD3B8AB6E5711317, 0xC17D4962DC4DDAB1,
0x959430F0809D2BBC, 0x68AFBA4665EC38AB, 0x3C46C3D4393CC9A6, 0x10223DEE1795ABE7, 0x44CB447C4B455AEA,
0xB9F0CECAAE3449FD, 0xED19B758F2E4B8F0, 0xD15F748CCBD87156, 0x85B60D1E9708805B, 0x788D87A87279934C,
@@ -166,9 +164,8 @@ public sealed class Crc64Context : IChecksum
0xE4B2222E9B192C23, 0x1989A8987E683F34, 0x4D60D10A22B8CE39, 0x61042F300C11AC78, 0x35ED56A250C15D75,
0xC8D6DC14B5B04E62, 0x9C3FA586E960BF6F, 0xA0796652D05C76C9, 0xF4901FC08C8C87C4, 0x09AB957669FD94D3,
0x5D42ECE4352D65DE
},
new ulong[]
{
],
[
0x0000000000000000, 0x3F0BE14A916A6DCB, 0x7E17C29522D4DB96, 0x411C23DFB3BEB65D, 0xFC2F852A45A9B72C,
0xC3246460D4C3DAE7, 0x823847BF677D6CBA, 0xBD33A6F5F6170171, 0x6A87A57F245D70DD, 0x558C4435B5371D16,
0x149067EA0689AB4B, 0x2B9B86A097E3C680, 0x96A8205561F4C7F1, 0xA9A3C11FF09EAA3A, 0xE8BFE2C043201C67,
@@ -221,9 +218,8 @@ public sealed class Crc64Context : IChecksum
0xBC798ABB271A2A8A, 0xFD65A96494A49CD7, 0xC26E482E05CEF11C, 0x15DA4BA4D78480B0, 0x2AD1AAEE46EEED7B,
0x6BCD8931F5505B26, 0x54C6687B643A36ED, 0xE9F5CE8E922D379C, 0xD6FE2FC403475A57, 0x97E20C1BB0F9EC0A,
0xA8E9ED51219381C1
},
new ulong[]
{
],
[
0x0000000000000000, 0x1DEE8A5E222CA1DC, 0x3BDD14BC445943B8, 0x26339EE26675E264, 0x77BA297888B28770,
0x6A54A326AA9E26AC, 0x4C673DC4CCEBC4C8, 0x5189B79AEEC76514, 0xEF7452F111650EE0, 0xF29AD8AF3349AF3C,
0xD4A9464D553C4D58, 0xC947CC137710EC84, 0x98CE7B8999D78990, 0x8520F1D7BBFB284C, 0xA3136F35DD8ECA28,
@@ -276,8 +272,8 @@ public sealed class Crc64Context : IChecksum
0xCAF59F413BFE0955, 0xECC601A35D8BEB31, 0xF1288BFD7FA74AED, 0x4FD56E9680052119, 0x523BE4C8A22980C5,
0x74087A2AC45C62A1, 0x69E6F074E670C37D, 0x386F47EE08B7A669, 0x2581CDB02A9B07B5, 0x03B253524CEEE5D1,
0x1E5CD90C6EC2440D
}
};
]
];
readonly ulong _finalSeed;
readonly IntPtr _nativeContext;

View File

@@ -73,7 +73,7 @@ public sealed class Md5Context : IChecksum
/// <summary>Returns a byte array of the hash value.</summary>
public byte[] Final()
{
_provider.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
_provider.TransformFinalBlock([], 0, 0);
return _provider.Hash;
}
@@ -82,7 +82,7 @@ public sealed class Md5Context : IChecksum
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
public string End()
{
_provider.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
_provider.TransformFinalBlock([], 0, 0);
var md5Output = new StringBuilder();
if(_provider.Hash is null) return null;

View File

@@ -92,66 +92,21 @@ public class ReedSolomon
{
_pp = m switch
{
2 => new[]
{
1, 1, 1
},
3 => new[]
{
1, 1, 0, 1
},
4 => new[]
{
1, 1, 0, 0, 1
},
5 => new[]
{
1, 0, 1, 0, 0, 1
},
6 => new[]
{
1, 1, 0, 0, 0, 0, 1
},
7 => new[]
{
1, 0, 0, 1, 0, 0, 0, 1
},
8 => new[]
{
1, 0, 1, 1, 1, 0, 0, 0, 1
},
9 => new[]
{
1, 0, 0, 0, 1, 0, 0, 0, 0, 1
},
10 => new[]
{
1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1
},
11 => new[]
{
1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1
},
12 => new[]
{
1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1
},
13 => new[]
{
1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1
},
14 => new[]
{
1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1
},
15 => new[]
{
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
},
16 => new[]
{
1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1
},
2 => [1, 1, 1],
3 => [1, 1, 0, 1],
4 => [1, 1, 0, 0, 1],
5 => [1, 0, 1, 0, 0, 1],
6 => [1, 1, 0, 0, 0, 0, 1],
7 => [1, 0, 0, 1, 0, 0, 0, 1],
8 => [1, 0, 1, 1, 1, 0, 0, 0, 1],
9 => [1, 0, 0, 0, 1, 0, 0, 0, 0, 1],
10 => [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1],
11 => [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
12 => [1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1],
13 => [1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
14 => [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1],
15 => [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
16 => [1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1],
_ => throw new ArgumentOutOfRangeException(nameof(m),
Localization.m_must_be_between_2_and_16_inclusive)
};
@@ -344,9 +299,8 @@ public class ReedSolomon
for(i = _kk - 1; i >= 0; i--)
{
if(_mm != 8)
{
if(data[i] > _nn) return -1; /* Illegal symbol */
}
if(data[i] > _nn)
return -1; /* Illegal symbol */
int feedback = _indexOf[data[i] ^ bb[_nn - _kk - 1]];
@@ -417,9 +371,8 @@ public class ReedSolomon
for(i = _nn - 1; i >= 0; i--)
{
if(_mm != 8)
{
if(data[i] > _nn) return -1; /* Illegal symbol */
}
if(data[i] > _nn)
return -1; /* Illegal symbol */
recd[i] = _indexOf[data[i]];
}
@@ -434,9 +387,8 @@ public class ReedSolomon
tmp = 0;
for(j = 0; j < _nn; j++)
{
if(recd[j] != _a0) /* recd[j] in index form */ tmp ^= _alphaTo[Modnn(recd[j] + (B0 + i - 1) * j)];
}
if(recd[j] != _a0) /* recd[j] in index form */
tmp ^= _alphaTo[Modnn(recd[j] + (B0 + i - 1) * j)];
synError |= tmp; /* set flag if non-zero syndrome =>
* error */
@@ -527,9 +479,8 @@ public class ReedSolomon
var discrR = 0;
for(i = 0; i < r; i++)
{
if(lambda[i] != 0 && s[r - i] != _a0) discrR ^= _alphaTo[Modnn(_indexOf[lambda[i]] + s[r - i])];
}
if(lambda[i] != 0 && s[r - i] != _a0)
discrR ^= _alphaTo[Modnn(_indexOf[lambda[i]] + s[r - i])];
discrR = _indexOf[discrR]; /* Index form */
@@ -635,9 +586,8 @@ public class ReedSolomon
j = degLambda < i ? degLambda : i;
for(; j >= 0; j--)
{
if(s[i + 1 - j] != _a0 && lambda[j] != _a0) tmp ^= _alphaTo[Modnn(s[i + 1 - j] + lambda[j])];
}
if(s[i + 1 - j] != _a0 && lambda[j] != _a0)
tmp ^= _alphaTo[Modnn(s[i + 1 - j] + lambda[j])];
if(tmp != 0) degOmega = i;
@@ -655,18 +605,16 @@ public class ReedSolomon
var num1 = 0;
for(i = degOmega; i >= 0; i--)
{
if(omega[i] != _a0) num1 ^= _alphaTo[Modnn(omega[i] + i * root[j])];
}
if(omega[i] != _a0)
num1 ^= _alphaTo[Modnn(omega[i] + i * root[j])];
int num2 = _alphaTo[Modnn(root[j] * (B0 - 1) + _nn)];
var den = 0;
/* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */
for(i = Min(degLambda, _nn - _kk - 1) & ~1; i >= 0; i -= 2)
{
if(lambda[i + 1] != _a0) den ^= _alphaTo[Modnn(lambda[i + 1] + i * root[j])];
}
if(lambda[i + 1] != _a0)
den ^= _alphaTo[Modnn(lambda[i + 1] + i * root[j])];
if(den == 0)
{

View File

@@ -77,7 +77,7 @@ public sealed class Sha1Context : IChecksum
/// <summary>Returns a byte array of the hash value.</summary>
public byte[] Final()
{
_provider.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
_provider.TransformFinalBlock([], 0, 0);
return _provider.Hash;
}
@@ -86,7 +86,7 @@ public sealed class Sha1Context : IChecksum
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
public string End()
{
_provider.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
_provider.TransformFinalBlock([], 0, 0);
var sha1Output = new StringBuilder();
if(_provider.Hash is null) return null;

View File

@@ -77,7 +77,7 @@ public sealed class Sha256Context : IChecksum
/// <summary>Returns a byte array of the hash value.</summary>
public byte[] Final()
{
_provider.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
_provider.TransformFinalBlock([], 0, 0);
return _provider.Hash;
}
@@ -86,7 +86,7 @@ public sealed class Sha256Context : IChecksum
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
public string End()
{
_provider.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
_provider.TransformFinalBlock([], 0, 0);
var sha256Output = new StringBuilder();
if(_provider.Hash is null) return null;

View File

@@ -78,7 +78,7 @@ public sealed class Sha384Context : IChecksum
/// <summary>Returns a byte array of the hash value.</summary>
public byte[] Final()
{
_provider.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
_provider.TransformFinalBlock([], 0, 0);
return _provider.Hash;
}
@@ -87,7 +87,7 @@ public sealed class Sha384Context : IChecksum
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
public string End()
{
_provider.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
_provider.TransformFinalBlock([], 0, 0);
var sha384Output = new StringBuilder();
if(_provider.Hash is null) return null;

View File

@@ -78,7 +78,7 @@ public sealed class Sha512Context : IChecksum
/// <summary>Returns a byte array of the hash value.</summary>
public byte[] Final()
{
_provider.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
_provider.TransformFinalBlock([], 0, 0);
return _provider.Hash;
}
@@ -87,7 +87,7 @@ public sealed class Sha512Context : IChecksum
/// <summary>Returns a hexadecimal representation of the hash value.</summary>
public string End()
{
_provider.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
_provider.TransformFinalBlock([], 0, 0);
var sha512Output = new StringBuilder();
if(_provider.Hash is null) return null;

View File

@@ -94,53 +94,53 @@ public class Metadata
var metadata = new Metadata
{
Developers = cicm.Developer is null ? null : new List<string>(cicm.Developer),
Publishers = cicm.Publisher is null ? null : new List<string>(cicm.Publisher),
Authors = cicm.Author is null ? null : new List<string>(cicm.Author),
Performers = cicm.Performer is null ? null : new List<string>(cicm.Performer),
Developers = cicm.Developer is null ? null : [..cicm.Developer],
Publishers = cicm.Publisher is null ? null : [..cicm.Publisher],
Authors = cicm.Author is null ? null : [..cicm.Author],
Performers = cicm.Performer is null ? null : [..cicm.Performer],
Name = cicm.Name,
Version = cicm.Version,
Release = cicm.ReleaseTypeSpecified ? (ReleaseType)cicm.ReleaseType : null,
ReleaseDate = cicm.ReleaseDateSpecified ? cicm.ReleaseDate : null,
PartNumber = cicm.PartNumber,
SerialNumber = cicm.SerialNumber,
Keywords = cicm.Keywords is null ? null : new List<string>(cicm.Keywords),
Categories = cicm.Categories is null ? null : new List<string>(cicm.Categories),
Subcategories = cicm.Subcategories is null ? null : new List<string>(cicm.Subcategories),
Systems = cicm.Systems is null ? null : new List<string>(cicm.Systems)
Keywords = cicm.Keywords is null ? null : [..cicm.Keywords],
Categories = cicm.Categories is null ? null : [..cicm.Categories],
Subcategories = cicm.Subcategories is null ? null : [..cicm.Subcategories],
Systems = cicm.Systems is null ? null : [..cicm.Systems]
};
if(cicm.Barcodes is not null)
{
metadata.Barcodes = new List<Barcode>();
metadata.Barcodes = [];
foreach(Schemas.BarcodeType code in cicm.Barcodes) metadata.Barcodes.Add(code);
}
if(cicm.Magazine is not null)
{
metadata.Magazines = new List<Magazine>();
metadata.Magazines = [];
foreach(MagazineType magazine in cicm.Magazine) metadata.Magazines.Add(magazine);
}
if(cicm.Book is not null)
{
metadata.Books = new List<Book>();
metadata.Books = [];
foreach(BookType book in cicm.Book) metadata.Books.Add(book);
}
if(cicm.Languages is not null)
{
metadata.Languages = new List<Language>();
metadata.Languages = [];
foreach(LanguagesTypeLanguage lng in cicm.Languages) metadata.Languages.Add((Language)lng);
}
if(cicm.Architectures is not null)
{
metadata.Architectures = new List<Architecture>();
metadata.Architectures = [];
foreach(ArchitecturesTypeArchitecture arch in cicm.Architectures)
metadata.Architectures.Add((Architecture)arch);
@@ -148,7 +148,7 @@ public class Metadata
if(cicm.RequiredOperatingSystems is not null)
{
metadata.RequiredOperatingSystems = new List<RequiredOperatingSystem>();
metadata.RequiredOperatingSystems = [];
foreach(RequiredOperatingSystemType os in cicm.RequiredOperatingSystems)
metadata.RequiredOperatingSystems.Add(os);
@@ -156,49 +156,49 @@ public class Metadata
if(cicm.UserManual is not null)
{
metadata.UserManuals = new List<UserManual>();
metadata.UserManuals = [];
foreach(UserManualType manual in cicm.UserManual) metadata.UserManuals.Add(manual);
}
if(cicm.OpticalDisc is not null)
{
metadata.OpticalDiscs = new List<OpticalDisc>();
metadata.OpticalDiscs = [];
foreach(OpticalDiscType disc in cicm.OpticalDisc) metadata.OpticalDiscs.Add(disc);
}
if(cicm.Advertisement is not null)
{
metadata.Advertisements = new List<Advertisement>();
metadata.Advertisements = [];
foreach(AdvertisementType adv in cicm.Advertisement) metadata.Advertisements.Add(adv);
}
if(cicm.LinearMedia is not null)
{
metadata.LinearMedias = new List<LinearMedia>();
metadata.LinearMedias = [];
foreach(LinearMediaType media in cicm.LinearMedia) metadata.LinearMedias.Add(media);
}
if(cicm.PCICard is not null)
{
metadata.PciCards = new List<Pci>();
metadata.PciCards = [];
foreach(PCIType pci in cicm.PCICard) metadata.PciCards.Add(pci);
}
if(cicm.BlockMedia is not null)
{
metadata.BlockMedias = new List<BlockMedia>();
metadata.BlockMedias = [];
foreach(BlockMediaType media in cicm.BlockMedia) metadata.BlockMedias.Add(media);
}
if(cicm.AudioMedia is null) return metadata;
metadata.AudioMedias = new List<AudioMedia>();
metadata.AudioMedias = [];
foreach(AudioMediaType media in cicm.AudioMedia) metadata.AudioMedias.Add(media);

View File

@@ -79,21 +79,21 @@ public class Advertisement
if(cicm.Checksums is not null)
{
adv.Checksums = new List<Checksum>();
adv.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) adv.Checksums.Add(chk);
}
if(cicm.AudioTrack is not null)
{
adv.AudioTracks = new List<AudioTrack>();
adv.AudioTracks = [];
foreach(AudioTracksType trk in cicm.AudioTrack) adv.AudioTracks.Add(trk);
}
if(cicm.VideoTrack is not null)
{
adv.VideoTracks = new List<VideoTrack>();
adv.VideoTracks = [];
foreach(VideoTracksType trk in cicm.VideoTrack) adv.VideoTracks.Add(trk);
}
@@ -101,7 +101,7 @@ public class Advertisement
if(cicm.SubtitleTrack is null) return adv;
{
adv.SubtitleTracks = new List<SubtitleTrack>();
adv.SubtitleTracks = [];
foreach(SubtitleTracksType trk in cicm.SubtitleTrack) adv.SubtitleTracks.Add(trk);
}

View File

@@ -84,21 +84,21 @@ public class AudioMedia
if(cicm.Checksums is not null)
{
media.Checksums = new List<Checksum>();
media.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) media.Checksums.Add(chk);
}
if(cicm.Block is not null)
{
media.Blocks = new List<AudioBlock>();
media.Blocks = [];
foreach(AudioBlockType blk in cicm.Block) media.Blocks.Add(blk);
}
if(cicm.DumpHardwareArray is null) return media;
media.DumpHardware = new List<DumpHardware>();
media.DumpHardware = [];
foreach(DumpHardwareType hw in cicm.DumpHardwareArray) media.DumpHardware.Add(hw);
@@ -129,7 +129,7 @@ public class AudioBlock
if(cicm.Checksums is null) return blk;
blk.Checksums = new List<Checksum>();
blk.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) blk.Checksums.Add(chk);

View File

@@ -74,7 +74,7 @@ public class AudioTrack
if(cicm.Languages is null) return trk;
trk.Languages = new List<Language>();
trk.Languages = [];
foreach(LanguagesTypeLanguage lng in cicm.Languages) trk.Languages.Add((Language)lng);
@@ -111,7 +111,7 @@ public class VideoTrack
if(cicm.Languages is null) return trk;
trk.Languages = new List<Language>();
trk.Languages = [];
foreach(LanguagesTypeLanguage lng in cicm.Languages) trk.Languages.Add((Language)lng);
@@ -138,7 +138,7 @@ public class SubtitleTrack
if(cicm.Languages is null) return sub;
sub.Languages = new List<Language>();
sub.Languages = [];
foreach(LanguagesTypeLanguage lng in cicm.Languages) sub.Languages.Add((Language)lng);
@@ -171,7 +171,7 @@ public class Recording
if(cicm.Software is null) return recording;
recording.Software = new List<Software>();
recording.Software = [];
foreach(SoftwareType sw in cicm.Software) recording.Software.Add(sw);

View File

@@ -124,28 +124,28 @@ public class BlockMedia
if(cicm.Checksums is not null)
{
media.Checksums = new List<Checksum>();
media.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) media.Checksums.Add(chk);
}
if(cicm.ContentChecksums is not null)
{
media.ContentChecksums = new List<Checksum>();
media.ContentChecksums = [];
foreach(Schemas.ChecksumType chk in cicm.ContentChecksums) media.ContentChecksums.Add(chk);
}
if(cicm.VariableBlockSize is not null)
{
media.VariableBlockSize = new List<BlockSize>();
media.VariableBlockSize = [];
foreach(BlockSizeType blkSize in cicm.VariableBlockSize) media.VariableBlockSize.Add(blkSize);
}
if(cicm.TapeInformation is not null)
{
media.TapeInformation = new List<TapePartition>();
media.TapeInformation = [];
foreach(TapePartitionType tapeInformation in cicm.TapeInformation)
media.TapeInformation.Add(tapeInformation);
@@ -153,14 +153,14 @@ public class BlockMedia
if(cicm.FileSystemInformation is not null)
{
media.FileSystemInformation = new List<Partition>();
media.FileSystemInformation = [];
foreach(PartitionType fsInfo in cicm.FileSystemInformation) media.FileSystemInformation.Add(fsInfo);
}
if(cicm.DumpHardwareArray is null) return media;
media.DumpHardware = new List<DumpHardware>();
media.DumpHardware = [];
foreach(DumpHardwareType hw in cicm.DumpHardwareArray) media.DumpHardware.Add(hw);
@@ -201,7 +201,7 @@ public class BlockTrack
if(cicm.Checksums is null) return trk;
trk.Checksums = new List<Checksum>();
trk.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) trk.Checksums.Add(chk);

View File

@@ -77,14 +77,14 @@ public class Book
if(cicm.Barcodes is not null)
{
book.Barcodes = new List<Barcode>();
book.Barcodes = [];
foreach(Schemas.BarcodeType code in cicm.Barcodes) book.Barcodes.Add(code);
}
if(cicm.Language is null) return book;
book.Languages = new List<Language>();
book.Languages = [];
foreach(LanguagesTypeLanguage lng in cicm.Language) book.Languages.Add((Language)lng);

View File

@@ -63,14 +63,14 @@ public class FilesystemContents
if(cicm.File is not null)
{
fs.Files = new List<ContentsFile>();
fs.Files = [];
foreach(ContentsFileType file in cicm.File) fs.Files.Add(file);
}
if(cicm.Directory is null) return fs;
fs.Directories = new List<Directory>();
fs.Directories = [];
foreach(DirectoryType dir in cicm.Directory) fs.Directories.Add(dir);
@@ -122,14 +122,14 @@ public class ContentsFile
if(cicm.Checksums is not null)
{
file.Checksums = new List<Checksum>();
file.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) file.Checksums.Add(chk);
}
if(cicm.ExtendedAttributes is null) return file;
file.ExtendedAttributes = new List<ExtendedAttribute>();
file.ExtendedAttributes = [];
foreach(ExtendedAttributeType xa in cicm.ExtendedAttributes) file.ExtendedAttributes.Add(xa);
@@ -156,7 +156,7 @@ public class ExtendedAttribute
if(cicm.Checksums is null) return xa;
xa.Checksums = new List<Checksum>();
xa.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) xa.Checksums.Add(chk);
@@ -206,14 +206,14 @@ public class Directory
if(cicm.Directory is not null)
{
dir.Directories = new List<Directory>();
dir.Directories = [];
foreach(DirectoryType d in cicm.Directory) dir.Directories.Add(d);
}
if(cicm.File is null) return dir;
dir.Files = new List<ContentsFile>();
dir.Files = [];
foreach(ContentsFileType file in cicm.File) dir.Files.Add(file);

View File

@@ -81,7 +81,7 @@ public class Dump
if(cicm.Checksums is null) return dump;
dump.Checksums = new List<Checksum>();
dump.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) dump.Checksums.Add(chk);
@@ -110,7 +110,7 @@ public class Border
if(cicm.Checksums is null) return border;
border.Checksums = new List<Checksum>();
border.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) border.Checksums.Add(chk);

View File

@@ -72,7 +72,7 @@ public class DumpHardware
if(cicm.Extents is null) return hw;
hw.Extents = new List<Extent>();
hw.Extents = [];
foreach(ExtentType ext in cicm.Extents) hw.Extents.Add(ext);

View File

@@ -64,7 +64,7 @@ public class Layers
if(cicm.Sectors is null) return layers;
layers.Sectors = new List<Sectors>();
layers.Sectors = [];
foreach(SectorsType sec in cicm.Sectors) layers.Sectors.Add(sec);

View File

@@ -94,21 +94,21 @@ public class LinearMedia
if(cicm.ImageChecksums is not null)
{
linearMedia.ImageChecksums = new List<Checksum>();
linearMedia.ImageChecksums = [];
foreach(Schemas.ChecksumType chk in cicm.ImageChecksums) linearMedia.ImageChecksums.Add(chk);
}
if(cicm.Checksums is not null)
{
linearMedia.Checksums = new List<Checksum>();
linearMedia.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) linearMedia.Checksums.Add(chk);
}
if(cicm.DumpHardwareArray is null) return linearMedia;
linearMedia.DumpHardware = new List<DumpHardware>();
linearMedia.DumpHardware = [];
foreach(DumpHardwareType hw in cicm.DumpHardwareArray) linearMedia.DumpHardware.Add(hw);

View File

@@ -76,7 +76,7 @@ public class Magazine
if(cicm.Barcodes is not null)
{
magazine.Barcodes = new List<Barcode>();
magazine.Barcodes = [];
foreach(Schemas.BarcodeType code in cicm.Barcodes) magazine.Barcodes.Add(code);
}

View File

@@ -142,77 +142,77 @@ public class OpticalDisc
if(cicm.Checksums is not null)
{
disc.Checksums = new List<Checksum>();
disc.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) disc.Checksums.Add(chk);
}
if(cicm.RingCode is not null)
{
disc.RingCode = new List<LayeredText>();
disc.RingCode = [];
foreach(LayeredTextType lt in cicm.RingCode) disc.RingCode.Add(lt);
}
if(cicm.MasteringSID is not null)
{
disc.MasteringSid = new List<LayeredText>();
disc.MasteringSid = [];
foreach(LayeredTextType lt in cicm.MasteringSID) disc.MasteringSid.Add(lt);
}
if(cicm.Toolstamp is not null)
{
disc.Toolstamp = new List<LayeredText>();
disc.Toolstamp = [];
foreach(LayeredTextType lt in cicm.Toolstamp) disc.Toolstamp.Add(lt);
}
if(cicm.MouldSID is not null)
{
disc.MouldSid = new List<LayeredText>();
disc.MouldSid = [];
foreach(LayeredTextType lt in cicm.MouldSID) disc.MouldSid.Add(lt);
}
if(cicm.MouldText is not null)
{
disc.MouldText = new List<LayeredText>();
disc.MouldText = [];
foreach(LayeredTextType lt in cicm.MouldText) disc.MouldText.Add(lt);
}
if(cicm.FirstTrackPregrap is not null)
{
disc.FirstTrackPregrap = new List<Border>();
disc.FirstTrackPregrap = [];
foreach(BorderType lt in cicm.FirstTrackPregrap) disc.FirstTrackPregrap.Add(lt);
}
if(cicm.LeadIn is not null)
{
disc.LeadIn = new List<Border>();
disc.LeadIn = [];
foreach(BorderType lt in cicm.LeadIn) disc.LeadIn.Add(lt);
}
if(cicm.LeadOut is not null)
{
disc.LeadOut = new List<Border>();
disc.LeadOut = [];
foreach(BorderType lt in cicm.LeadOut) disc.LeadOut.Add(lt);
}
if(cicm.Track is not null)
{
disc.Track = new List<Track>();
disc.Track = [];
foreach(Schemas.TrackType lt in cicm.Track) disc.Track.Add(lt);
}
if(cicm.DumpHardwareArray is null) return disc;
disc.DumpHardware = new List<DumpHardware>();
disc.DumpHardware = [];
foreach(DumpHardwareType hw in cicm.DumpHardwareArray) disc.DumpHardware.Add(hw);
@@ -263,21 +263,21 @@ public class Track
if(cicm.Indexes is not null)
{
trk.Indexes = new List<TrackIndex>();
trk.Indexes = [];
foreach(TrackIndexType idx in cicm.Indexes) trk.Indexes.Add(idx);
}
if(cicm.Checksums is not null)
{
trk.Checksums = new List<Checksum>();
trk.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) trk.Checksums.Add(chk);
}
if(cicm.FileSystemInformation is null) return trk;
trk.FileSystemInformation = new List<Partition>();
trk.FileSystemInformation = [];
foreach(PartitionType fs in cicm.FileSystemInformation) trk.FileSystemInformation.Add(fs);
@@ -368,7 +368,7 @@ public class SubChannel
if(cicm.Checksums is null) return subchannel;
subchannel.Checksums = new List<Checksum>();
subchannel.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) subchannel.Checksums.Add(chk);

View File

@@ -75,7 +75,6 @@ public class Pcmcia
AdditionalInformation =
cicm.AdditionalInformation is null
? null
: new List<string>(cicm
.AdditionalInformation)
: [..cicm.AdditionalInformation]
};
}

View File

@@ -72,7 +72,7 @@ public class Partition
if(cicm.FileSystems is null) return part;
part.FileSystems = new List<FileSystem>();
part.FileSystems = [];
foreach(FileSystemType fs in cicm.FileSystems) part.FileSystems.Add(fs);

View File

@@ -56,6 +56,6 @@ public class RequiredOperatingSystem
: new RequiredOperatingSystem
{
Name = cicm.Name,
Versions = cicm.Version is null ? null : new List<string>(cicm.Version)
Versions = cicm.Version is null ? null : [..cicm.Version]
};
}

View File

@@ -68,7 +68,7 @@ public class SCSI
if(cicm.EVPD is null) return cicm;
scsi.Evpds = new List<Evpd>();
scsi.Evpds = [];
foreach(EVPDType evpd in cicm.EVPD) scsi.Evpds.Add(evpd);
@@ -97,7 +97,7 @@ public class Evpd
if(cicm.Checksums is null) return evpd;
evpd.Checksums = new List<Checksum>();
evpd.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) evpd.Checksums.Add(chk);

View File

@@ -66,28 +66,28 @@ public class Scan
if(cicm.Checksums is not null)
{
scan.Checksums = new List<Checksum>();
scan.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) scan.Checksums.Add(chk);
}
if(cicm.Scanner is not null)
{
scan.Scanner = new List<Scanner>();
scan.Scanner = [];
foreach(ScannerType scanner in cicm.Scanner) scan.Scanner.Add(scanner);
}
if(cicm.ScanProcessing is not null)
{
scan.ScanProcessing = new List<ScanProcessing>();
scan.ScanProcessing = [];
foreach(ScanProcessingType processing in cicm.ScanProcessing) scan.ScanProcessing.Add(processing);
}
if(cicm.OCR is null) return scan;
scan.OCR = new List<OCR>();
scan.OCR = [];
foreach(OCRType ocr in cicm.OCR) scan.OCR.Add(ocr);
@@ -114,7 +114,7 @@ public class Cover
if(cicm.Checksums is null) return cover;
cover.Checksums = new List<Checksum>();
cover.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) cover.Checksums.Add(chk);
@@ -303,7 +303,7 @@ public class OCR
if(cicm.Language is null) return ocr;
ocr.Language = new List<Language>();
ocr.Language = [];
foreach(Language lng in cicm.Language) ocr.Language.Add(lng);

View File

@@ -71,14 +71,14 @@ public class TapePartition
if(cicm.Checksums is not null)
{
partition.Checksums = new List<Checksum>();
partition.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) partition.Checksums.Add(chk);
}
if(cicm.File is null) return partition;
partition.Files = new List<TapeFile>();
partition.Files = [];
foreach(TapeFileType file in cicm.File) partition.Files.Add(file);
@@ -113,7 +113,7 @@ public class TapeFile
if(cicm.Checksums is null) return file;
file.Checksums = new List<Checksum>();
file.Checksums = [];
foreach(Schemas.ChecksumType chk in cicm.Checksums) file.Checksums.Add(chk);

View File

@@ -66,7 +66,7 @@ public class UserManual
if(cicm.Language is null) return manual;
manual.Language = new List<Language>();
manual.Language = [];
foreach(LanguagesTypeLanguage lng in cicm.Language) manual.Language.Add((Language)lng);

View File

@@ -52,13 +52,13 @@ public sealed class ExtentsByte
List<Tuple<byte, byte>> _backend;
/// <summary>Initialize an empty list of extents</summary>
public ExtentsByte() => _backend = new List<Tuple<byte, byte>>();
public ExtentsByte() => _backend = [];
/// <summary>Initializes extents with an specific list</summary>
/// <param name="list">List of extents as tuples "start, end"</param>
public ExtentsByte(IEnumerable<Tuple<byte, byte>> list)
{
_backend = new List<Tuple<byte, byte>>();
_backend = [];
// This ensure no overlapping extents are added on creation
foreach(Tuple<byte, byte> t in list) Add(t.Item1, t.Item2);

View File

@@ -54,7 +54,7 @@ public static class ExtentsConverter
if(extents == null) return null;
Tuple<ulong, ulong>[] tuples = extents.ToArray();
List<Extent> list = new();
List<Extent> list = [];
for(ulong i = 0; i < (ulong)tuples.LongLength; i++)
{

View File

@@ -52,13 +52,13 @@ public sealed class ExtentsInt
List<Tuple<int, int>> _backend;
/// <summary>Initialize an empty list of extents</summary>
public ExtentsInt() => _backend = new List<Tuple<int, int>>();
public ExtentsInt() => _backend = [];
/// <summary>Initializes extents with an specific list</summary>
/// <param name="list">List of extents as tuples "start, end"</param>
public ExtentsInt(IEnumerable<Tuple<int, int>> list)
{
_backend = new List<Tuple<int, int>>();
_backend = [];
// This ensure no overlapping extents are added on creation
foreach(Tuple<int, int> t in list) Add(t.Item1, t.Item2);

View File

@@ -51,13 +51,13 @@ public sealed class ExtentsLong
List<Tuple<long, long>> _backend;
/// <summary>Initialize an empty list of extents</summary>
public ExtentsLong() => _backend = new List<Tuple<long, long>>();
public ExtentsLong() => _backend = [];
/// <summary>Initializes extents with an specific list</summary>
/// <param name="list">List of extents as tuples "start, end"</param>
public ExtentsLong(IEnumerable<Tuple<long, long>> list)
{
_backend = new List<Tuple<long, long>>();
_backend = [];
// This ensure no overlapping extents are added on creation
foreach(Tuple<long, long> t in list) Add(t.Item1, t.Item2);

View File

@@ -52,13 +52,13 @@ public sealed class ExtentsSByte
List<Tuple<sbyte, sbyte>> _backend;
/// <summary>Initialize an empty list of extents</summary>
public ExtentsSByte() => _backend = new List<Tuple<sbyte, sbyte>>();
public ExtentsSByte() => _backend = [];
/// <summary>Initializes extents with an specific list</summary>
/// <param name="list">List of extents as tuples "start, end"</param>
public ExtentsSByte(IEnumerable<Tuple<sbyte, sbyte>> list)
{
_backend = new List<Tuple<sbyte, sbyte>>();
_backend = [];
// This ensure no overlapping extents are added on creation
foreach(Tuple<sbyte, sbyte> t in list) Add(t.Item1, t.Item2);

View File

@@ -52,13 +52,13 @@ public sealed class ExtentsShort
List<Tuple<short, short>> _backend;
/// <summary>Initialize an empty list of extents</summary>
public ExtentsShort() => _backend = new List<Tuple<short, short>>();
public ExtentsShort() => _backend = [];
/// <summary>Initializes extents with an specific list</summary>
/// <param name="list">List of extents as tuples "start, end"</param>
public ExtentsShort(IEnumerable<Tuple<short, short>> list)
{
_backend = new List<Tuple<short, short>>();
_backend = [];
// This ensure no overlapping extents are added on creation
foreach(Tuple<short, short> t in list) Add(t.Item1, t.Item2);

View File

@@ -52,13 +52,13 @@ public sealed class ExtentsUInt
List<Tuple<uint, uint>> _backend;
/// <summary>Initialize an empty list of extents</summary>
public ExtentsUInt() => _backend = new List<Tuple<uint, uint>>();
public ExtentsUInt() => _backend = [];
/// <summary>Initializes extents with an specific list</summary>
/// <param name="list">List of extents as tuples "start, end"</param>
public ExtentsUInt(IEnumerable<Tuple<uint, uint>> list)
{
_backend = new List<Tuple<uint, uint>>();
_backend = [];
// This ensure no overlapping extents are added on creation
foreach(Tuple<uint, uint> t in list) Add(t.Item1, t.Item2);

View File

@@ -52,13 +52,13 @@ public sealed class ExtentsULong
List<Tuple<ulong, ulong>> _backend;
/// <summary>Initialize an empty list of extents</summary>
public ExtentsULong() => _backend = new List<Tuple<ulong, ulong>>();
public ExtentsULong() => _backend = [];
/// <summary>Initializes extents with an specific list</summary>
/// <param name="list">List of extents as tuples "start, end"</param>
public ExtentsULong(IEnumerable<Tuple<ulong, ulong>> list)
{
_backend = new List<Tuple<ulong, ulong>>();
_backend = [];
// This ensure no overlapping extents are added on creation
foreach(Tuple<ulong, ulong> t in list) Add(t.Item1, t.Item2);

View File

@@ -52,13 +52,13 @@ public sealed class ExtentsUShort
List<Tuple<ushort, ushort>> _backend;
/// <summary>Initialize an empty list of extents</summary>
public ExtentsUShort() => _backend = new List<Tuple<ushort, ushort>>();
public ExtentsUShort() => _backend = [];
/// <summary>Initializes extents with an specific list</summary>
/// <param name="list">List of extents as tuples "start, end"</param>
public ExtentsUShort(IEnumerable<Tuple<ushort, ushort>> list)
{
_backend = new List<Tuple<ushort, ushort>>();
_backend = [];
// This ensure no overlapping extents are added on creation
foreach(Tuple<ushort, ushort> t in list) Add(t.Item1, t.Item2);

View File

@@ -46,7 +46,7 @@ public static class Geometry
/// <summary>List of known disk geometries</summary>
public static readonly (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding
encoding, bool variableSectorsPerTrack, MediaType type)[] KnownGeometries =
{
[
(32, 1, 8, 319, MediaEncoding.FM, false, MediaType.IBM23FD),
(35, 1, 9, 256, MediaEncoding.FM, false, MediaType.ECMA_66),
(35, 1, 13, 256, MediaEncoding.AppleGCR, false, MediaType.Apple32SS),
@@ -118,7 +118,7 @@ public static class Geometry
(963, 8, 32, 512, MediaEncoding.MFM, false, MediaType.LS120),
(1021, 64, 32, 512, MediaEncoding.MFM, false, MediaType.Jaz),
(1024, 2, 32, 512, MediaEncoding.MFM, false, MediaType.FD32MB)
};
];
/// <summary>Gets the media type for a given geometry</summary>
/// <param name="geometry">Geometry</param>

View File

@@ -266,8 +266,7 @@ public class PluginRegister
{
if(!filter.Identify(path)) continue;
var foundFilter =
(IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(Array.Empty<object>());
var foundFilter = (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke([]);
if(foundFilter?.Open(path) == ErrorNumber.NoError) return foundFilter;
}

View File

@@ -80,7 +80,7 @@ public class TeleDiskLzh
/* decoder table */
readonly byte[] _dCode =
{
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
@@ -96,10 +96,10 @@ public class TeleDiskLzh
0x24, 0x24, 0x25, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x29, 0x2A, 0x2A, 0x2B, 0x2B, 0x2C, 0x2C,
0x2D, 0x2D, 0x2E, 0x2E, 0x2F, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
0x3C, 0x3D, 0x3E, 0x3F
};
];
readonly byte[] _dLen =
{
[
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
@@ -115,7 +115,7 @@ public class TeleDiskLzh
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08
};
];
readonly ushort[] _freq = new ushort[T + 1]; /* cumulative freq table */
readonly Stream _inStream;

View File

@@ -18,57 +18,51 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
namespace CUETools.Codecs.Flake
namespace CUETools.Codecs.Flake;
public class FlakeConstants
{
public class FlakeConstants
{
public const int MAX_BLOCKSIZE = 65535;
public const int MAX_RICE_PARAM = 14;
public const int MAX_PARTITION_ORDER = 8;
public const int MAX_PARTITIONS = 1 << MAX_PARTITION_ORDER;
public const int MAX_BLOCKSIZE = 65535;
public const int MAX_RICE_PARAM = 14;
public const int MAX_PARTITION_ORDER = 8;
public const int MAX_PARTITIONS = 1 << MAX_PARTITION_ORDER;
public const int FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN = 64; /* bits */
public const int FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN = 64; /* bits */
public const int FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN = 16; /* bits */
public const int FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN = 64; /* bits */
public const int FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN = 64; /* bits */
public const int FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN = 16; /* bits */
public static readonly int[] flac_samplerates = new int[16] {
0, 88200, 176400, 192000,
8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000,
0, 0, 0, 0
};
//1100 : get 8 bit sample rate (in kHz) from end of header
//1101 : get 16 bit sample rate (in Hz) from end of header
//1110 : get 16 bit sample rate (in tens of Hz) from end of header
public static readonly int[] flac_blocksizes = new int[15] { 0, 192, 576, 1152, 2304, 4608, 0, 0, 256, 512, 1024, 2048, 4096, 8192, 16384 };
//0110 : get 8 bit (blocksize-1) from end of header
//0111 : get 16 bit (blocksize-1) from end of header
public static readonly int[] flac_bitdepths = new int[8] { 0, 8, 12, 0, 16, 20, 24, 0 };
public static readonly int[] flac_samplerates =
[
0, 88200, 176400, 192000, 8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000, 0, 0, 0, 0
];
public static PredictionType LookupPredictionType(string name)
{
return (PredictionType)(Enum.Parse(typeof(PredictionType), name, true));
}
//1100 : get 8 bit sample rate (in kHz) from end of header
//1101 : get 16 bit sample rate (in Hz) from end of header
//1110 : get 16 bit sample rate (in tens of Hz) from end of header
public static readonly int[] flac_blocksizes =
[
0, 192, 576, 1152, 2304, 4608, 0, 0, 256, 512, 1024, 2048, 4096, 8192, 16384
];
public static StereoMethod LookupStereoMethod(string name)
{
return (StereoMethod)(Enum.Parse(typeof(StereoMethod), name, true));
}
//0110 : get 8 bit (blocksize-1) from end of header
//0111 : get 16 bit (blocksize-1) from end of header
public static readonly int[] flac_bitdepths = [0, 8, 12, 0, 16, 20, 24, 0];
public static WindowMethod LookupWindowMethod(string name)
{
return (WindowMethod)(Enum.Parse(typeof(WindowMethod), name, true));
}
public static PredictionType LookupPredictionType(string name) =>
(PredictionType)Enum.Parse(typeof(PredictionType), name, true);
public static OrderMethod LookupOrderMethod(string name)
{
return (OrderMethod)(Enum.Parse(typeof(OrderMethod), name, true));
}
public static StereoMethod LookupStereoMethod(string name) =>
(StereoMethod)Enum.Parse(typeof(StereoMethod), name, true);
public static WindowFunction LookupWindowFunction(string name)
{
return (WindowFunction)(Enum.Parse(typeof(WindowFunction), name, true));
}
}
}
public static WindowMethod LookupWindowMethod(string name) =>
(WindowMethod)Enum.Parse(typeof(WindowMethod), name, true);
public static OrderMethod LookupOrderMethod(string name) =>
(OrderMethod)Enum.Parse(typeof(OrderMethod), name, true);
public static WindowFunction LookupWindowFunction(string name) =>
(WindowFunction)Enum.Parse(typeof(WindowFunction), name, true);
}

View File

@@ -1,335 +1,309 @@
using System;
namespace CUETools.Codecs
namespace CUETools.Codecs;
public unsafe class BitReader
{
unsafe public class BitReader
byte* bptr_m;
int buffer_len_m;
ulong cache_m;
ushort crc16_m;
int have_bits_m;
public BitReader()
{
#region Static Methods
Buffer = null;
bptr_m = null;
buffer_len_m = 0;
have_bits_m = 0;
cache_m = 0;
crc16_m = 0;
}
public static int log2i(int v)
public BitReader(byte* _buffer, int _pos, int _len)
{
Reset(_buffer, _pos, _len);
}
public int Position => (int)(bptr_m - Buffer - (have_bits_m >> 3));
public byte* Buffer { get; private set; }
public void Reset(byte* _buffer, int _pos, int _len)
{
Buffer = _buffer;
bptr_m = _buffer + _pos;
buffer_len_m = _len;
have_bits_m = 0;
cache_m = 0;
crc16_m = 0;
fill();
}
public void fill()
{
while(have_bits_m < 56)
{
return log2i((uint)v);
have_bits_m += 8;
byte b = *bptr_m++;
cache_m |= (ulong)b << 64 - have_bits_m;
crc16_m = (ushort)(crc16_m << 8 ^ Crc16.table[crc16_m >> 8 ^ b]);
}
}
public static readonly byte[] MultiplyDeBruijnBitPosition = new byte[32]
{
0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30,
8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31
};
public static int log2i(ulong v)
{
v |= v >> 1; // first round down to one less than a power of 2
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
if (v >> 32 == 0)
return MultiplyDeBruijnBitPosition[(uint)((uint)v * 0x07C4ACDDU) >> 27];
return 32 + MultiplyDeBruijnBitPosition[(uint)((uint)(v >> 32) * 0x07C4ACDDU) >> 27];
}
public static int log2i(uint v)
{
v |= v >> 1; // first round down to one less than a power of 2
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
return MultiplyDeBruijnBitPosition[(uint)(v * 0x07C4ACDDU) >> 27];
}
public static readonly byte[] byte_to_unary_table = new byte[]
{
8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#endregion
private byte* buffer_m;
private byte* bptr_m;
private int buffer_len_m;
private int have_bits_m;
private ulong cache_m;
private ushort crc16_m;
public int Position
{
get { return (int)(bptr_m - buffer_m - (have_bits_m >> 3)); }
}
public byte* Buffer
{
get
{
return buffer_m;
}
}
public BitReader()
{
buffer_m = null;
bptr_m = null;
buffer_len_m = 0;
have_bits_m = 0;
cache_m = 0;
crc16_m = 0;
}
public BitReader(byte* _buffer, int _pos, int _len)
{
Reset(_buffer, _pos, _len);
}
public void Reset(byte* _buffer, int _pos, int _len)
{
buffer_m = _buffer;
bptr_m = _buffer + _pos;
buffer_len_m = _len;
have_bits_m = 0;
cache_m = 0;
crc16_m = 0;
fill();
}
public void fill()
{
while (have_bits_m < 56)
{
have_bits_m += 8;
byte b = *(bptr_m++);
cache_m |= (ulong)b << (64 - have_bits_m);
crc16_m = (ushort)((crc16_m << 8) ^ Crc16.table[(crc16_m >> 8) ^ b]);
}
}
/* skip any number of bits */
public void skipbits(int bits)
{
while (bits > have_bits_m)
{
bits -= have_bits_m;
cache_m = 0;
have_bits_m = 0;
fill();
}
cache_m <<= bits;
have_bits_m -= bits;
}
public long read_long()
{
return ((long)readbits(32) << 32) | readbits(32);
}
public ulong read_ulong()
{
return ((ulong)readbits(32) << 32) | readbits(32);
}
public int read_int()
{
return (int)readbits(sizeof(int));
}
public uint read_uint()
{
return (uint)readbits(sizeof(uint));
}
public short read_short()
{
return (short)readbits(16);
}
public ushort read_ushort()
{
return (ushort)readbits(16);
}
/* supports reading 1 to 32 bits, in big endian format */
public uint readbits(int bits)
/* skip any number of bits */
public void skipbits(int bits)
{
while(bits > have_bits_m)
{
bits -= have_bits_m;
cache_m = 0;
have_bits_m = 0;
fill();
uint result = (uint)(cache_m >> 64 - bits);
skipbits(bits);
return result;
}
/* supports reading 1 to 64 bits, in big endian format */
public ulong readbits64(int bits)
{
if (bits <= 56)
return readbits(bits);
return ((ulong)readbits(32) << bits - 32) | readbits(bits - 32);
}
cache_m <<= bits;
have_bits_m -= bits;
}
/* reads a single bit */
public uint readbit()
{
return readbits(1);
}
public long read_long() => (long)readbits(32) << 32 | readbits(32);
public uint read_unary()
{
fill();
uint val = 0;
ulong result = cache_m >> 56;
while (result == 0)
{
val += 8;
cache_m <<= 8;
byte b = *(bptr_m++);
cache_m |= (ulong)b << (64 - have_bits_m);
crc16_m = (ushort)((crc16_m << 8) ^ Crc16.table[(crc16_m >> 8) ^ b]);
result = cache_m >> 56;
}
val += byte_to_unary_table[result];
skipbits((int)(val & 7) + 1);
return val;
}
public ulong read_ulong() => (ulong)readbits(32) << 32 | readbits(32);
public void flush()
{
if ((have_bits_m & 7) > 0)
{
cache_m <<= have_bits_m & 7;
have_bits_m -= have_bits_m & 7;
}
}
public int read_int() => (int)readbits(sizeof(int));
public ushort get_crc16()
public uint read_uint() => readbits(sizeof(uint));
public short read_short() => (short)readbits(16);
public ushort read_ushort() => (ushort)readbits(16);
/* supports reading 1 to 32 bits, in big endian format */
public uint readbits(int bits)
{
fill();
var result = (uint)(cache_m >> 64 - bits);
skipbits(bits);
return result;
}
/* supports reading 1 to 64 bits, in big endian format */
public ulong readbits64(int bits)
{
if(bits <= 56) return readbits(bits);
return (ulong)readbits(32) << bits - 32 | readbits(bits - 32);
}
/* reads a single bit */
public uint readbit() => readbits(1);
public uint read_unary()
{
fill();
uint val = 0;
ulong result = cache_m >> 56;
while(result == 0)
{
if (have_bits_m == 0)
return crc16_m;
ushort crc = 0;
int n = have_bits_m >> 3;
for (int i = 0; i < n; i++)
crc = (ushort)((crc << 8) ^ Crc16.table[(crc >> 8) ^ (byte)(cache_m >> (56 - (i << 3)))]);
return Crc16.Subtract(crc16_m, crc, n);
val += 8;
cache_m <<= 8;
byte b = *bptr_m++;
cache_m |= (ulong)b << 64 - have_bits_m;
crc16_m = (ushort)(crc16_m << 8 ^ Crc16.table[crc16_m >> 8 ^ b]);
result = cache_m >> 56;
}
public int readbits_signed(int bits)
{
int val = (int)readbits(bits);
val <<= (32 - bits);
val >>= (32 - bits);
return val;
}
val += byte_to_unary_table[result];
skipbits((int)(val & 7) + 1);
public uint read_utf8()
{
uint x = readbits(8);
uint v;
int i;
if (0 == (x & 0x80))
{
v = x;
i = 0;
}
else if (0xC0 == (x & 0xE0)) /* 110xxxxx */
{
v = x & 0x1F;
i = 1;
}
else if (0xE0 == (x & 0xF0)) /* 1110xxxx */
{
v = x & 0x0F;
i = 2;
}
else if (0xF0 == (x & 0xF8)) /* 11110xxx */
{
v = x & 0x07;
i = 3;
}
else if (0xF8 == (x & 0xFC)) /* 111110xx */
{
v = x & 0x03;
i = 4;
}
else if (0xFC == (x & 0xFE)) /* 1111110x */
{
v = x & 0x01;
i = 5;
}
else if (0xFE == x) /* 11111110 */
{
v = 0;
i = 6;
}
else
{
throw new Exception("invalid utf8 encoding");
}
for (; i > 0; i--)
{
x = readbits(8);
if (0x80 != (x & 0xC0)) /* 10xxxxxx */
throw new Exception("invalid utf8 encoding");
v <<= 6;
v |= (x & 0x3F);
}
return v;
}
return val;
}
public void read_rice_block(int n, int k, int* r)
{
fill();
fixed (byte* unary_table = byte_to_unary_table)
fixed (ushort* t = Crc16.table)
public void flush()
{
if((have_bits_m & 7) > 0)
{
cache_m <<= have_bits_m & 7;
have_bits_m -= have_bits_m & 7;
}
}
public ushort get_crc16()
{
if(have_bits_m == 0) return crc16_m;
ushort crc = 0;
int n = have_bits_m >> 3;
for(var i = 0; i < n; i++) crc = (ushort)(crc << 8 ^ Crc16.table[crc >> 8 ^ (byte)(cache_m >> 56 - (i << 3))]);
return Crc16.Subtract(crc16_m, crc, n);
}
public int readbits_signed(int bits)
{
var val = (int)readbits(bits);
val <<= 32 - bits;
val >>= 32 - bits;
return val;
}
public uint read_utf8()
{
uint x = readbits(8);
uint v;
int i;
if(0 == (x & 0x80))
{
v = x;
i = 0;
}
else if(0xC0 == (x & 0xE0)) /* 110xxxxx */
{
v = x & 0x1F;
i = 1;
}
else if(0xE0 == (x & 0xF0)) /* 1110xxxx */
{
v = x & 0x0F;
i = 2;
}
else if(0xF0 == (x & 0xF8)) /* 11110xxx */
{
v = x & 0x07;
i = 3;
}
else if(0xF8 == (x & 0xFC)) /* 111110xx */
{
v = x & 0x03;
i = 4;
}
else if(0xFC == (x & 0xFE)) /* 1111110x */
{
v = x & 0x01;
i = 5;
}
else if(0xFE == x) /* 11111110 */
{
v = 0;
i = 6;
}
else
throw new Exception("invalid utf8 encoding");
for(; i > 0; i--)
{
x = readbits(8);
if(0x80 != (x & 0xC0)) /* 10xxxxxx */ throw new Exception("invalid utf8 encoding");
v <<= 6;
v |= x & 0x3F;
}
return v;
}
public void read_rice_block(int n, int k, int* r)
{
fill();
fixed(byte* unary_table = byte_to_unary_table)
{
fixed(ushort* t = Crc16.table)
{
uint mask = (1U << k) - 1;
byte* bptr = bptr_m;
int have_bits = have_bits_m;
ulong cache = cache_m;
ushort crc = crc16_m;
for (int i = n; i > 0; i--)
uint mask = (1U << k) - 1;
byte* bptr = bptr_m;
int have_bits = have_bits_m;
ulong cache = cache_m;
ushort crc = crc16_m;
for(int i = n; i > 0; i--)
{
uint bits;
uint bits;
byte* orig_bptr = bptr;
while ((bits = unary_table[cache >> 56]) == 8)
while((bits = unary_table[cache >> 56]) == 8)
{
cache <<= 8;
byte b = *(bptr++);
cache |= (ulong)b << (64 - have_bits);
crc = (ushort)((crc << 8) ^ t[(crc >> 8) ^ b]);
}
uint msbs = bits + ((uint)(bptr - orig_bptr) << 3);
// assumes k <= 41 (have_bits < 41 + 7 + 1 + 8 == 57, so we don't loose bits here)
while (have_bits < 56)
{
have_bits += 8;
byte b = *(bptr++);
cache |= (ulong)b << (64 - have_bits);
crc = (ushort)((crc << 8) ^ t[(crc >> 8) ^ b]);
byte b = *bptr++;
cache |= (ulong)b << 64 - have_bits;
crc = (ushort)(crc << 8 ^ t[crc >> 8 ^ b]);
}
int btsk = k + (int)bits + 1;
uint uval = (msbs << k) | (uint)((cache >> (64 - btsk)) & mask);
cache <<= btsk;
have_bits -= btsk;
*(r++) = (int)(uval >> 1 ^ -(int)(uval & 1));
uint msbs = bits + ((uint)(bptr - orig_bptr) << 3);
// assumes k <= 41 (have_bits < 41 + 7 + 1 + 8 == 57, so we don't loose bits here)
while(have_bits < 56)
{
have_bits += 8;
byte b = *bptr++;
cache |= (ulong)b << 64 - have_bits;
crc = (ushort)(crc << 8 ^ t[crc >> 8 ^ b]);
}
int btsk = k + (int)bits + 1;
uint uval = msbs << k | (uint)(cache >> 64 - btsk & mask);
cache <<= btsk;
have_bits -= btsk;
*r++ = (int)(uval >> 1 ^ -(int)(uval & 1));
}
have_bits_m = have_bits;
cache_m = cache;
bptr_m = bptr;
crc16_m = crc;
cache_m = cache;
bptr_m = bptr;
crc16_m = crc;
}
}
}
}
}
}
#region Static Methods
public static int log2i(int v) => log2i((uint)v);
public static readonly byte[] MultiplyDeBruijnBitPosition =
[
0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26,
5, 4, 31
];
public static int log2i(ulong v)
{
v |= v >> 1; // first round down to one less than a power of 2
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
if(v >> 32 == 0) return MultiplyDeBruijnBitPosition[(uint)v * 0x07C4ACDDU >> 27];
return 32 + MultiplyDeBruijnBitPosition[(uint)(v >> 32) * 0x07C4ACDDU >> 27];
}
public static int log2i(uint v)
{
v |= v >> 1; // first round down to one less than a power of 2
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
return MultiplyDeBruijnBitPosition[v * 0x07C4ACDDU >> 27];
}
public static readonly byte[] byte_to_unary_table =
[
8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0
];
#endregion
}

View File

@@ -1,51 +1,54 @@
namespace CUETools.Codecs
namespace CUETools.Codecs;
public enum InitialCrcValue
{
public enum InitialCrcValue { Zeros, NonZero1 = 0xffff, NonZero2 = 0x1D0F }
public class Crc16Ccitt
{
const ushort poly = 4129;
ushort[] table = new ushort[256];
ushort initialValue = 0;
public ushort ComputeChecksum(byte[] bytes, int pos, int count)
{
ushort crc = this.initialValue;
for (int i = pos; i < pos + count; i++)
{
crc = (ushort)((crc << 8) ^ table[((crc >> 8) ^ (0xff & bytes[i]))]);
}
return crc;
}
public byte[] ComputeChecksumBytes(byte[] bytes, int pos, int count)
{
ushort crc = ComputeChecksum(bytes, pos, count);
return new byte[] { (byte)(crc >> 8), (byte)(crc & 0x00ff) };
}
public Crc16Ccitt(InitialCrcValue initialValue)
{
this.initialValue = (ushort)initialValue;
ushort temp, a;
for (int i = 0; i < table.Length; i++)
{
temp = 0;
a = (ushort)(i << 8);
for (int j = 0; j < 8; j++)
{
if (((temp ^ a) & 0x8000) != 0)
{
temp = (ushort)((temp << 1) ^ poly);
}
else
{
temp <<= 1;
}
a <<= 1;
}
table[i] = temp;
}
}
}
Zeros,
NonZero1 = 0xffff,
NonZero2 = 0x1D0F
}
public class Crc16Ccitt
{
const ushort poly = 4129;
readonly ushort initialValue;
readonly ushort[] table = new ushort[256];
public Crc16Ccitt(InitialCrcValue initialValue)
{
this.initialValue = (ushort)initialValue;
ushort temp, a;
for(var i = 0; i < table.Length; i++)
{
temp = 0;
a = (ushort)(i << 8);
for(var j = 0; j < 8; j++)
{
if(((temp ^ a) & 0x8000) != 0)
temp = (ushort)(temp << 1 ^ poly);
else
temp <<= 1;
a <<= 1;
}
table[i] = temp;
}
}
public ushort ComputeChecksum(byte[] bytes, int pos, int count)
{
ushort crc = initialValue;
for(int i = pos; i < pos + count; i++) crc = (ushort)(crc << 8 ^ table[crc >> 8 ^ 0xff & bytes[i]]);
return crc;
}
public byte[] ComputeChecksumBytes(byte[] bytes, int pos, int count)
{
ushort crc = ComputeChecksum(bytes, pos, count);
return [(byte)(crc >> 8), (byte)(crc & 0x00ff)];
}
}

View File

@@ -1,94 +1,296 @@
using Newtonsoft.Json;
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Threading;
using System.Xml;
using System.Xml.Serialization;
using CUETools.Codecs.CommandLine;
using Newtonsoft.Json;
namespace CUETools.Codecs
namespace CUETools.Codecs;
public class CUEToolsCodecsConfig
{
public class CUEToolsCodecsConfig
public List<IAudioDecoderSettings> decoders;
[JsonIgnore]
public DecoderListViewModel decodersViewModel;
public List<IAudioEncoderSettings> encoders;
[JsonIgnore]
public EncoderListViewModel encodersViewModel;
[JsonIgnore]
public Dictionary<string, CUEToolsFormat> formats;
public CUEToolsCodecsConfig()
{
[JsonIgnore]
public Dictionary<string, CUEToolsFormat> formats;
public List<IAudioEncoderSettings> encoders;
public List<IAudioDecoderSettings> decoders;
[JsonIgnore]
public EncoderListViewModel encodersViewModel;
[JsonIgnore]
public DecoderListViewModel decodersViewModel;
public CUEToolsCodecsConfig()
{
encoders = new List<IAudioEncoderSettings>();
decoders = new List<IAudioDecoderSettings>();
encodersViewModel = new EncoderListViewModel(encoders);
decodersViewModel = new DecoderListViewModel(decoders);
formats = new Dictionary<string, CUEToolsFormat>();
}
public CUEToolsCodecsConfig(CUEToolsCodecsConfig src)
{
encoders = new List<IAudioEncoderSettings>();
decoders = new List<IAudioDecoderSettings>();
src.encoders.ForEach(item => encoders.Add(item.Clone()));
src.decoders.ForEach(item => decoders.Add(item.Clone()));
encodersViewModel = new EncoderListViewModel(encoders);
decodersViewModel = new DecoderListViewModel(decoders);
formats = new Dictionary<string, CUEToolsFormat>();
foreach (var fmt in src.formats)
formats.Add(fmt.Key, fmt.Value.Clone(this));
}
public void Init(List<IAudioEncoderSettings> src_encoders, List<IAudioDecoderSettings> src_decoders)
{
encoders = new List<IAudioEncoderSettings>();
decoders = new List<IAudioDecoderSettings>();
src_encoders.ForEach(item => encoders.Add(item.Clone()));
src_decoders.ForEach(item => decoders.Add(item.Clone()));
if (Type.GetType("Mono.Runtime", false) == null)
{
encoders.Add(new CommandLine.EncoderSettings("flake.exe", "flac", true, "0 1 2 3 4 5 6 7 8 9 10 11 12", "8", "flake.exe", "-%M - -o %O -p %P"));
encoders.Add(new CommandLine.EncoderSettings("takc.exe", "tak", true, "0 1 2 2e 2m 3 3e 3m 4 4e 4m", "2", "takc.exe", "-e -p%M -overwrite - %O"));
encoders.Add(new CommandLine.EncoderSettings("ffmpeg.exe", "m4a", true, "", "", "ffmpeg.exe", "-i - -f ipod -acodec alac -y %O"));
encoders.Add(new CommandLine.EncoderSettings("lame.exe (VBR)", "mp3", false, "V9 V8 V7 V6 V5 V4 V3 V2 V1 V0", "V2", "lame.exe", "--vbr-new -%M - %O"));
encoders.Add(new CommandLine.EncoderSettings("lame.exe (CBR)", "mp3", false, "96 128 192 256 320", "256", "lame.exe", "-m s -q 0 -b %M --noreplaygain - %O"));
encoders.Add(new CommandLine.EncoderSettings("oggenc.exe", "ogg", false, "-1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8", "3", "oggenc.exe", "-q %M - -o %O"));
encoders.Add(new CommandLine.EncoderSettings("opusenc.exe", "opus", false, "6 16 32 48 64 96 128 192 256", "128", "opusenc.exe", "--bitrate %M - %O"));
encoders.Add(new CommandLine.EncoderSettings("neroAacEnc.exe", "m4a", false, "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9", "0.4", "neroAacEnc.exe", "-q %M -if - -of %O"));
encoders.Add(new CommandLine.EncoderSettings("qaac.exe (tvbr)", "m4a", false, "10 20 30 40 50 60 70 80 90 100 110 127", "80", "qaac.exe", "-s -V %M -q 2 - -o %O"));
decoders.Add(new CommandLine.DecoderSettings("takc.exe", "tak", "takc.exe", "-d %I -"));
decoders.Add(new CommandLine.DecoderSettings("ffmpeg.exe", "m4a", "ffmpeg.exe", "-v 0 -i %I -f wav -"));
}
else
{
// !!!
}
encodersViewModel = new EncoderListViewModel(encoders);
decodersViewModel = new DecoderListViewModel(decoders);
formats = new Dictionary<string, CUEToolsFormat>();
formats.Add("flac", new CUEToolsFormat("flac", CUEToolsTagger.TagLibSharp, true, false, true, true, encodersViewModel.GetDefault("flac", true), null, decodersViewModel.GetDefault("flac")));
formats.Add("wv", new CUEToolsFormat("wv", CUEToolsTagger.TagLibSharp, true, false, true, true, encodersViewModel.GetDefault("wv", true), null, decodersViewModel.GetDefault("wv")));
formats.Add("ape", new CUEToolsFormat("ape", CUEToolsTagger.TagLibSharp, true, false, true, true, encodersViewModel.GetDefault("ape", true), null, decodersViewModel.GetDefault("ape")));
formats.Add("tta", new CUEToolsFormat("tta", CUEToolsTagger.APEv2, true, false, false, true, encodersViewModel.GetDefault("tta", true), null, decodersViewModel.GetDefault("tta")));
formats.Add("m2ts", new CUEToolsFormat("m2ts", CUEToolsTagger.APEv2, true, false, false, true, null, null, decodersViewModel.GetDefault("m2ts")));
formats.Add("mpls", new CUEToolsFormat("mpls", CUEToolsTagger.APEv2, true, false, false, true, null, null, decodersViewModel.GetDefault("mpls")));
formats.Add("wav", new CUEToolsFormat("wav", CUEToolsTagger.TagLibSharp, true, false, false, true, encodersViewModel.GetDefault("wav", true), null, decodersViewModel.GetDefault("wav")));
formats.Add("m4a", new CUEToolsFormat("m4a", CUEToolsTagger.TagLibSharp, true, true, false, true, encodersViewModel.GetDefault("m4a", true), encodersViewModel.GetDefault("m4a", false), decodersViewModel.GetDefault("m4a")));
formats.Add("tak", new CUEToolsFormat("tak", CUEToolsTagger.APEv2, true, false, true, true, encodersViewModel.GetDefault("tak", true), null, decodersViewModel.GetDefault("tak")));
formats.Add("wma", new CUEToolsFormat("wma", CUEToolsTagger.TagLibSharp, true, true, false, true, encodersViewModel.GetDefault("wma", true), encodersViewModel.GetDefault("wma", false), decodersViewModel.GetDefault("wma")));
formats.Add("mp3", new CUEToolsFormat("mp3", CUEToolsTagger.TagLibSharp, false, true, false, true, null, encodersViewModel.GetDefault("mp3", false), null));
formats.Add("ogg", new CUEToolsFormat("ogg", CUEToolsTagger.TagLibSharp, false, true, false, true, null, encodersViewModel.GetDefault("ogg", false), null));
formats.Add("opus", new CUEToolsFormat("opus", CUEToolsTagger.TagLibSharp, false, true, false, true, null, encodersViewModel.GetDefault("opus", false), null));
formats.Add("mlp", new CUEToolsFormat("mlp", CUEToolsTagger.APEv2, true, false, false, false, null, null, decodersViewModel.GetDefault("mlp")));
formats.Add("aob", new CUEToolsFormat("aob", CUEToolsTagger.APEv2, true, false, false, false, null, null, decodersViewModel.GetDefault("aob")));
}
encoders = [];
decoders = [];
encodersViewModel = new EncoderListViewModel(encoders);
decodersViewModel = new DecoderListViewModel(decoders);
formats = new Dictionary<string, CUEToolsFormat>();
}
}
public CUEToolsCodecsConfig(CUEToolsCodecsConfig src)
{
encoders = [];
decoders = [];
src.encoders.ForEach(item => encoders.Add(item.Clone()));
src.decoders.ForEach(item => decoders.Add(item.Clone()));
encodersViewModel = new EncoderListViewModel(encoders);
decodersViewModel = new DecoderListViewModel(decoders);
formats = new Dictionary<string, CUEToolsFormat>();
foreach(KeyValuePair<string, CUEToolsFormat> fmt in src.formats) formats.Add(fmt.Key, fmt.Value.Clone(this));
}
public void Init(List<IAudioEncoderSettings> src_encoders, List<IAudioDecoderSettings> src_decoders)
{
encoders = [];
decoders = [];
src_encoders.ForEach(item => encoders.Add(item.Clone()));
src_decoders.ForEach(item => decoders.Add(item.Clone()));
if(Type.GetType("Mono.Runtime", false) == null)
{
encoders.Add(new EncoderSettings("flake.exe",
"flac",
true,
"0 1 2 3 4 5 6 7 8 9 10 11 12",
"8",
"flake.exe",
"-%M - -o %O -p %P"));
encoders.Add(new EncoderSettings("takc.exe",
"tak",
true,
"0 1 2 2e 2m 3 3e 3m 4 4e 4m",
"2",
"takc.exe",
"-e -p%M -overwrite - %O"));
encoders.Add(new EncoderSettings("ffmpeg.exe",
"m4a",
true,
"",
"",
"ffmpeg.exe",
"-i - -f ipod -acodec alac -y %O"));
encoders.Add(new EncoderSettings("lame.exe (VBR)",
"mp3",
false,
"V9 V8 V7 V6 V5 V4 V3 V2 V1 V0",
"V2",
"lame.exe",
"--vbr-new -%M - %O"));
encoders.Add(new EncoderSettings("lame.exe (CBR)",
"mp3",
false,
"96 128 192 256 320",
"256",
"lame.exe",
"-m s -q 0 -b %M --noreplaygain - %O"));
encoders.Add(new EncoderSettings("oggenc.exe",
"ogg",
false,
"-1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8",
"3",
"oggenc.exe",
"-q %M - -o %O"));
encoders.Add(new EncoderSettings("opusenc.exe",
"opus",
false,
"6 16 32 48 64 96 128 192 256",
"128",
"opusenc.exe",
"--bitrate %M - %O"));
encoders.Add(new EncoderSettings("neroAacEnc.exe",
"m4a",
false,
"0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9",
"0.4",
"neroAacEnc.exe",
"-q %M -if - -of %O"));
encoders.Add(new EncoderSettings("qaac.exe (tvbr)",
"m4a",
false,
"10 20 30 40 50 60 70 80 90 100 110 127",
"80",
"qaac.exe",
"-s -V %M -q 2 - -o %O"));
decoders.Add(new DecoderSettings("takc.exe", "tak", "takc.exe", "-d %I -"));
decoders.Add(new DecoderSettings("ffmpeg.exe", "m4a", "ffmpeg.exe", "-v 0 -i %I -f wav -"));
}
// !!!
encodersViewModel = new EncoderListViewModel(encoders);
decodersViewModel = new DecoderListViewModel(decoders);
formats = new Dictionary<string, CUEToolsFormat>();
formats.Add("flac",
new CUEToolsFormat("flac",
CUEToolsTagger.TagLibSharp,
true,
false,
true,
true,
encodersViewModel.GetDefault("flac", true),
null,
decodersViewModel.GetDefault("flac")));
formats.Add("wv",
new CUEToolsFormat("wv",
CUEToolsTagger.TagLibSharp,
true,
false,
true,
true,
encodersViewModel.GetDefault("wv", true),
null,
decodersViewModel.GetDefault("wv")));
formats.Add("ape",
new CUEToolsFormat("ape",
CUEToolsTagger.TagLibSharp,
true,
false,
true,
true,
encodersViewModel.GetDefault("ape", true),
null,
decodersViewModel.GetDefault("ape")));
formats.Add("tta",
new CUEToolsFormat("tta",
CUEToolsTagger.APEv2,
true,
false,
false,
true,
encodersViewModel.GetDefault("tta", true),
null,
decodersViewModel.GetDefault("tta")));
formats.Add("m2ts",
new CUEToolsFormat("m2ts",
CUEToolsTagger.APEv2,
true,
false,
false,
true,
null,
null,
decodersViewModel.GetDefault("m2ts")));
formats.Add("mpls",
new CUEToolsFormat("mpls",
CUEToolsTagger.APEv2,
true,
false,
false,
true,
null,
null,
decodersViewModel.GetDefault("mpls")));
formats.Add("wav",
new CUEToolsFormat("wav",
CUEToolsTagger.TagLibSharp,
true,
false,
false,
true,
encodersViewModel.GetDefault("wav", true),
null,
decodersViewModel.GetDefault("wav")));
formats.Add("m4a",
new CUEToolsFormat("m4a",
CUEToolsTagger.TagLibSharp,
true,
true,
false,
true,
encodersViewModel.GetDefault("m4a", true),
encodersViewModel.GetDefault("m4a", false),
decodersViewModel.GetDefault("m4a")));
formats.Add("tak",
new CUEToolsFormat("tak",
CUEToolsTagger.APEv2,
true,
false,
true,
true,
encodersViewModel.GetDefault("tak", true),
null,
decodersViewModel.GetDefault("tak")));
formats.Add("wma",
new CUEToolsFormat("wma",
CUEToolsTagger.TagLibSharp,
true,
true,
false,
true,
encodersViewModel.GetDefault("wma", true),
encodersViewModel.GetDefault("wma", false),
decodersViewModel.GetDefault("wma")));
formats.Add("mp3",
new CUEToolsFormat("mp3",
CUEToolsTagger.TagLibSharp,
false,
true,
false,
true,
null,
encodersViewModel.GetDefault("mp3", false),
null));
formats.Add("ogg",
new CUEToolsFormat("ogg",
CUEToolsTagger.TagLibSharp,
false,
true,
false,
true,
null,
encodersViewModel.GetDefault("ogg", false),
null));
formats.Add("opus",
new CUEToolsFormat("opus",
CUEToolsTagger.TagLibSharp,
false,
true,
false,
true,
null,
encodersViewModel.GetDefault("opus", false),
null));
formats.Add("mlp",
new CUEToolsFormat("mlp",
CUEToolsTagger.APEv2,
true,
false,
false,
false,
null,
null,
decodersViewModel.GetDefault("mlp")));
formats.Add("aob",
new CUEToolsFormat("aob",
CUEToolsTagger.APEv2,
true,
false,
false,
false,
null,
null,
decodersViewModel.GetDefault("aob")));
}
}

View File

@@ -1,82 +1,98 @@
using System;
using System.Collections.Generic;
namespace CUETools.Codecs
namespace CUETools.Codecs;
public interface IAudioSource
{
public interface IAudioSource
{
IAudioDecoderSettings Settings { get; }
IAudioDecoderSettings Settings { get; }
AudioPCMConfig PCM { get; }
string Path { get; }
AudioPCMConfig PCM { get; }
string Path { get; }
TimeSpan Duration { get; }
long Length { get; }
long Position { get; set; }
long Remaining { get; }
TimeSpan Duration { get; }
long Length { get; }
long Position { get; set; }
long Remaining { get; }
int Read(AudioBuffer buffer, int maxLength);
void Close();
}
int Read(AudioBuffer buffer, int maxLength);
void Close();
}
public interface IAudioTitle
public interface IAudioTitle
{
List<TimeSpan> Chapters { get; }
AudioPCMConfig PCM { get; }
string Codec { get; }
string Language { get; }
int StreamId { get; }
//IAudioSource Open { get; }
}
public interface IAudioTitleSet
{
List<IAudioTitle> AudioTitles { get; }
}
public static class IAudioTitleExtensions
{
public static TimeSpan GetDuration(this IAudioTitle title)
{
List<TimeSpan> Chapters { get; }
AudioPCMConfig PCM { get; }
string Codec { get; }
string Language { get; }
int StreamId { get; }
//IAudioSource Open { get; }
List<TimeSpan> chapters = title.Chapters;
return chapters[chapters.Count - 1];
}
public interface IAudioTitleSet
public static string GetRateString(this IAudioTitle title)
{
List<IAudioTitle> AudioTitles { get; }
int sr = title.PCM.SampleRate;
if(sr % 1000 == 0) return $"{sr / 1000}KHz";
if(sr % 100 == 0) return $"{sr / 100}.{sr / 100 % 10}KHz";
return $"{sr}Hz";
}
public static class IAudioTitleExtensions
public static string GetFormatString(this IAudioTitle title)
{
public static TimeSpan GetDuration(this IAudioTitle title)
switch(title.PCM.ChannelCount)
{
var chapters = title.Chapters;
return chapters[chapters.Count - 1];
case 1:
return "mono";
case 2:
return "stereo";
default:
return "multi-channel";
}
public static string GetRateString(this IAudioTitle title)
{
var sr = title.PCM.SampleRate;
if (sr % 1000 == 0) return $"{sr / 1000}KHz";
if (sr % 100 == 0) return $"{sr / 100}.{(sr / 100) % 10}KHz";
return $"{sr}Hz";
}
public static string GetFormatString(this IAudioTitle title)
{
switch (title.PCM.ChannelCount)
{
case 1: return "mono";
case 2: return "stereo";
default: return "multi-channel";
}
}
}
public class SingleAudioTitle : IAudioTitle
{
public SingleAudioTitle(IAudioSource source) { this.source = source; }
public List<TimeSpan> Chapters => new List<TimeSpan> { TimeSpan.Zero, source.Duration };
public AudioPCMConfig PCM => source.PCM;
public string Codec => source.Settings.Extension;
public string Language => "";
public int StreamId => 0;
IAudioSource source;
}
public class SingleAudioTitleSet : IAudioTitleSet
{
public SingleAudioTitleSet(IAudioSource source) { this.source = source; }
public List<IAudioTitle> AudioTitles => new List<IAudioTitle> { new SingleAudioTitle(source) };
IAudioSource source;
}
}
public class SingleAudioTitle : IAudioTitle
{
readonly IAudioSource source;
public SingleAudioTitle(IAudioSource source) => this.source = source;
#region IAudioTitle Members
public List<TimeSpan> Chapters => [TimeSpan.Zero, source.Duration];
public AudioPCMConfig PCM => source.PCM;
public string Codec => source.Settings.Extension;
public string Language => "";
public int StreamId => 0;
#endregion
}
public class SingleAudioTitleSet : IAudioTitleSet
{
readonly IAudioSource source;
public SingleAudioTitleSet(IAudioSource source) => this.source = source;
#region IAudioTitleSet Members
public List<IAudioTitle> AudioTitles => [new SingleAudioTitle(source)];
#endregion
}

View File

@@ -1,56 +1,56 @@
using System;
using System.ComponentModel;
using System.Reflection;
namespace CUETools.Codecs
namespace CUETools.Codecs;
/// <summary>
/// Localized description attribute
/// </summary>
[AttributeUsage(AttributeTargets.All)]
public class SRDescriptionAttribute : DescriptionAttribute
{
/// <summary>
/// Localized description attribute
/// </summary>
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
public class SRDescriptionAttribute : DescriptionAttribute
/// <summary>
/// Resource manager to use;
/// </summary>
readonly Type SR;
/// <summary>
/// Store a flag indicating whether this has been localized
/// </summary>
bool localized;
/// <summary>
/// Construct the description attribute
/// </summary>
/// <param name="text"></param>
public SRDescriptionAttribute(Type SR, string text) : base(text)
{
/// <summary>
/// Store a flag indicating whether this has been localized
/// </summary>
private bool localized;
localized = false;
this.SR = SR;
}
/// <summary>
/// Resource manager to use;
/// </summary>
private Type SR;
/// <summary>
/// Override the return of the description text to localize the text
/// </summary>
public override string Description
{
get
{
if(!localized)
{
localized = true;
/// <summary>
/// Construct the description attribute
/// </summary>
/// <param name="text"></param>
public SRDescriptionAttribute(Type SR, string text)
: base(text)
{
this.localized = false;
this.SR = SR;
}
DescriptionValue = SR.InvokeMember(DescriptionValue,
BindingFlags.GetProperty |
BindingFlags.Static |
BindingFlags.Public |
BindingFlags.NonPublic,
null,
null,
[]) as string;
}
/// <summary>
/// Override the return of the description text to localize the text
/// </summary>
public override string Description
{
get
{
if (!localized)
{
localized = true;
this.DescriptionValue = SR.InvokeMember(
this.DescriptionValue,
System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic,
null,
null,
new object[] { }) as string;
}
return base.Description;
}
}
}
}
return base.Description;
}
}
}

View File

@@ -2,179 +2,181 @@
using System.Collections.Generic;
using System.IO;
namespace CUETools.Codecs.WAV
namespace CUETools.Codecs.WAV;
public class AudioEncoder : IAudioDest
{
public class AudioEncoder : IAudioDest
readonly EncoderSettings m_settings;
BinaryWriter _bw;
List<uint> _chunkFCCs;
List<byte[]> _chunks;
long _finalSampleCount = -1;
bool _headersWritten;
Stream _IO;
long hdrLen;
public AudioEncoder(EncoderSettings settings, string path, Stream IO = null)
{
private Stream _IO;
private BinaryWriter _bw;
private long _sampleLen;
private string _path;
private long hdrLen = 0;
private bool _headersWritten = false;
private long _finalSampleCount = -1;
private List<byte[]> _chunks = null;
private List<uint> _chunkFCCs = null;
public long Position
{
get
{
return _sampleLen;
}
}
public long FinalSampleCount
{
set { _finalSampleCount = value; }
}
private EncoderSettings m_settings;
public IAudioEncoderSettings Settings => m_settings;
public string Path { get { return _path; } }
public AudioEncoder(EncoderSettings settings, string path, Stream IO = null)
{
m_settings = settings;
_path = path;
_IO = IO ?? new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read);
_bw = new BinaryWriter(_IO);
}
public void WriteChunk(uint fcc, byte[] data)
{
if (_sampleLen > 0)
throw new Exception("data already written, no chunks allowed");
if (_chunks == null)
{
_chunks = new List<byte[]>();
_chunkFCCs = new List<uint>();
}
_chunkFCCs.Add(fcc);
_chunks.Add(data);
hdrLen += 8 + data.Length + (data.Length & 1);
}
private void WriteHeaders()
{
const uint fccRIFF = 0x46464952;
const uint fccWAVE = 0x45564157;
const uint fccFormat = 0x20746D66;
const uint fccData = 0x61746164;
bool wavex = (Settings.PCM.BitsPerSample != 16 && Settings.PCM.BitsPerSample != 24) || Settings.PCM.ChannelMask != AudioPCMConfig.GetDefaultChannelMask(Settings.PCM.ChannelCount);
hdrLen += 36 + (wavex ? 24 : 0) + 8;
uint dataLen = (uint)(_finalSampleCount * Settings.PCM.BlockAlign);
uint dataLenPadded = dataLen + (dataLen & 1);
_bw.Write(fccRIFF);
if (_finalSampleCount <= 0)
_bw.Write((uint)0xffffffff);
else
_bw.Write((uint)(dataLenPadded + hdrLen - 8));
_bw.Write(fccWAVE);
_bw.Write(fccFormat);
if (wavex)
{
_bw.Write((uint)40);
_bw.Write((ushort)0xfffe); // WAVEX follows
}
else
{
_bw.Write((uint)16);
_bw.Write((ushort)1); // PCM
}
_bw.Write((ushort)Settings.PCM.ChannelCount);
_bw.Write((uint)Settings.PCM.SampleRate);
_bw.Write((uint)(Settings.PCM.SampleRate * Settings.PCM.BlockAlign));
_bw.Write((ushort)Settings.PCM.BlockAlign);
_bw.Write((ushort)((Settings.PCM.BitsPerSample + 7) / 8 * 8));
if (wavex)
{
_bw.Write((ushort)22); // length of WAVEX structure
_bw.Write((ushort)Settings.PCM.BitsPerSample);
_bw.Write((uint)Settings.PCM.ChannelMask);
_bw.Write((ushort)1); // PCM Guid
_bw.Write((ushort)0);
_bw.Write((ushort)0);
_bw.Write((ushort)0x10);
_bw.Write((byte)0x80);
_bw.Write((byte)0x00);
_bw.Write((byte)0x00);
_bw.Write((byte)0xaa);
_bw.Write((byte)0x00);
_bw.Write((byte)0x38);
_bw.Write((byte)0x9b);
_bw.Write((byte)0x71);
}
if (_chunks != null)
for (int i = 0; i < _chunks.Count; i++)
{
_bw.Write(_chunkFCCs[i]);
_bw.Write((uint)_chunks[i].Length);
_bw.Write(_chunks[i]);
if ((_chunks[i].Length & 1) != 0)
_bw.Write((byte)0);
}
_bw.Write(fccData);
if (_finalSampleCount <= 0)
_bw.Write((uint)0xffffffff);
else
_bw.Write(dataLen);
_headersWritten = true;
}
public void Close()
{
if (_finalSampleCount <= 0 && _IO.CanSeek)
{
long dataLen = _sampleLen * Settings.PCM.BlockAlign;
long dataLenPadded = dataLen + (dataLen & 1);
if (dataLenPadded + hdrLen - 8 < 0xffffffff)
{
if ((dataLen & 1) == 1)
_bw.Write((byte)0);
_bw.Seek(4, SeekOrigin.Begin);
_bw.Write((uint)(dataLenPadded + hdrLen - 8));
_bw.Seek((int)hdrLen - 4, SeekOrigin.Begin);
_bw.Write((uint)dataLen);
}
}
_bw.Close();
_bw = null;
_IO = null;
if (_finalSampleCount > 0 && _sampleLen != _finalSampleCount)
throw new Exception("Samples written differs from the expected sample count.");
}
public void Delete()
{
_bw.Close();
_bw = null;
_IO = null;
if (_path != "")
File.Delete(_path);
}
public void Write(AudioBuffer buff)
{
if (buff.Length == 0)
return;
buff.Prepare(this);
if (!_headersWritten)
WriteHeaders();
_IO.Write(buff.Bytes, 0, buff.ByteLength);
_sampleLen += buff.Length;
}
m_settings = settings;
Path = path;
_IO = IO ?? new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read);
_bw = new BinaryWriter(_IO);
}
}
public long Position { get; private set; }
#region IAudioDest Members
public long FinalSampleCount
{
set => _finalSampleCount = value;
}
public IAudioEncoderSettings Settings => m_settings;
public string Path { get; }
public void Close()
{
if(_finalSampleCount <= 0 && _IO.CanSeek)
{
long dataLen = Position * Settings.PCM.BlockAlign;
long dataLenPadded = dataLen + (dataLen & 1);
if(dataLenPadded + hdrLen - 8 < 0xffffffff)
{
if((dataLen & 1) == 1) _bw.Write((byte)0);
_bw.Seek(4, SeekOrigin.Begin);
_bw.Write((uint)(dataLenPadded + hdrLen - 8));
_bw.Seek((int)hdrLen - 4, SeekOrigin.Begin);
_bw.Write((uint)dataLen);
}
}
_bw.Close();
_bw = null;
_IO = null;
if(_finalSampleCount > 0 && Position != _finalSampleCount)
throw new Exception("Samples written differs from the expected sample count.");
}
public void Delete()
{
_bw.Close();
_bw = null;
_IO = null;
if(Path != "") File.Delete(Path);
}
public void Write(AudioBuffer buff)
{
if(buff.Length == 0) return;
buff.Prepare(this);
if(!_headersWritten) WriteHeaders();
_IO.Write(buff.Bytes, 0, buff.ByteLength);
Position += buff.Length;
}
#endregion
public void WriteChunk(uint fcc, byte[] data)
{
if(Position > 0) throw new Exception("data already written, no chunks allowed");
if(_chunks == null)
{
_chunks = [];
_chunkFCCs = [];
}
_chunkFCCs.Add(fcc);
_chunks.Add(data);
hdrLen += 8 + data.Length + (data.Length & 1);
}
void WriteHeaders()
{
const uint fccRIFF = 0x46464952;
const uint fccWAVE = 0x45564157;
const uint fccFormat = 0x20746D66;
const uint fccData = 0x61746164;
bool wavex = Settings.PCM.BitsPerSample != 16 && Settings.PCM.BitsPerSample != 24 ||
Settings.PCM.ChannelMask != AudioPCMConfig.GetDefaultChannelMask(Settings.PCM.ChannelCount);
hdrLen += 36 + (wavex ? 24 : 0) + 8;
var dataLen = (uint)(_finalSampleCount * Settings.PCM.BlockAlign);
uint dataLenPadded = dataLen + (dataLen & 1);
_bw.Write(fccRIFF);
if(_finalSampleCount <= 0)
_bw.Write(0xffffffff);
else
_bw.Write((uint)(dataLenPadded + hdrLen - 8));
_bw.Write(fccWAVE);
_bw.Write(fccFormat);
if(wavex)
{
_bw.Write((uint)40);
_bw.Write((ushort)0xfffe); // WAVEX follows
}
else
{
_bw.Write((uint)16);
_bw.Write((ushort)1); // PCM
}
_bw.Write((ushort)Settings.PCM.ChannelCount);
_bw.Write((uint)Settings.PCM.SampleRate);
_bw.Write((uint)(Settings.PCM.SampleRate * Settings.PCM.BlockAlign));
_bw.Write((ushort)Settings.PCM.BlockAlign);
_bw.Write((ushort)((Settings.PCM.BitsPerSample + 7) / 8 * 8));
if(wavex)
{
_bw.Write((ushort)22); // length of WAVEX structure
_bw.Write((ushort)Settings.PCM.BitsPerSample);
_bw.Write((uint)Settings.PCM.ChannelMask);
_bw.Write((ushort)1); // PCM Guid
_bw.Write((ushort)0);
_bw.Write((ushort)0);
_bw.Write((ushort)0x10);
_bw.Write((byte)0x80);
_bw.Write((byte)0x00);
_bw.Write((byte)0x00);
_bw.Write((byte)0xaa);
_bw.Write((byte)0x00);
_bw.Write((byte)0x38);
_bw.Write((byte)0x9b);
_bw.Write((byte)0x71);
}
if(_chunks != null)
{
for(var i = 0; i < _chunks.Count; i++)
{
_bw.Write(_chunkFCCs[i]);
_bw.Write((uint)_chunks[i].Length);
_bw.Write(_chunks[i]);
if((_chunks[i].Length & 1) != 0) _bw.Write((byte)0);
}
}
_bw.Write(fccData);
if(_finalSampleCount <= 0)
_bw.Write(0xffffffff);
else
_bw.Write(dataLen);
_headersWritten = true;
}
}

View File

@@ -370,7 +370,7 @@ public sealed class Checksum
/// <returns>Returns the checksum results</returns>
public List<CommonTypes.AaruMetadata.Checksum> End()
{
List<CommonTypes.AaruMetadata.Checksum> chks = new();
List<CommonTypes.AaruMetadata.Checksum> chks = [];
if(_enabled.HasFlag(EnableChecksum.Adler32))
{
@@ -680,7 +680,7 @@ public sealed class Checksum
f16ThreadData.IsAlive ||
f32ThreadData.IsAlive) {}
List<CommonTypes.AaruMetadata.Checksum> dataChecksums = new();
List<CommonTypes.AaruMetadata.Checksum> dataChecksums = [];
if(enabled.HasFlag(EnableChecksum.Adler32))
{

View File

@@ -103,7 +103,7 @@ public partial class Dump
double currentSpeed = 0;
double maxSpeed = double.MinValue;
double minSpeed = double.MaxValue;
cmdBuf = Array.Empty<byte>();
cmdBuf = [];
// Initialize reader
UpdateStatus?.Invoke(Localization.Core.Initializing_reader);
@@ -895,7 +895,9 @@ public partial class Dump
$"{version.MajorVersion}.{version.MinorVersion}";
sidecar.BlockMedias[0].Pcmcia.AdditionalInformation =
new List<string>(version.AdditionalInformation);
[
..version.AdditionalInformation
];
}
break;
@@ -937,7 +939,7 @@ public partial class Dump
.Per(totalChkDuration.Milliseconds())
.Humanize());
List<(ulong start, string type)> filesystems = new();
List<(ulong start, string type)> filesystems = [];
if(sidecar.BlockMedias[0].FileSystemInformation != null)
{

View File

@@ -58,10 +58,7 @@ partial class Dump
{
if(sector?.Length != 2352) return false;
byte[] syncMark =
{
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00
};
byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
var testMark = new byte[12];
Array.Copy(sector, 0, testMark, 0, 12);
@@ -80,10 +77,7 @@ partial class Dump
if(sector?.Length != 2352) return false;
byte[] syncMark =
{
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00
};
byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
var testMark = new byte[12];

View File

@@ -115,7 +115,7 @@ sealed partial class Dump
var bcdSubchannel = false; // Subchannel positioning is in BCD
Dictionary<byte, string> isrcs = new();
string mcn = null;
HashSet<int> subchannelExtents = new();
HashSet<int> subchannelExtents = [];
var cdiReadyReadAsAudio = false;
uint firstLba;
var outputOptical = _outputPlugin as IWritableOpticalImage;
@@ -647,8 +647,8 @@ sealed partial class Dump
return;
}
List<Track> trkList = new()
{
List<Track> trkList =
[
new Track
{
Sequence = (uint)(tracks.Any(t => t.Sequence == 1) ? 0 : 1),
@@ -660,7 +660,7 @@ sealed partial class Dump
SubchannelType = subType,
EndSector = tracks.First(t => t.Sequence >= 1).StartSector - 1
}
};
];
trkList.AddRange(tracks);
tracks = trkList.ToArray();
@@ -1068,12 +1068,7 @@ sealed partial class Dump
_dumpLog.WriteLine(Localization.Core.Setting_flags_for_track_0, track.Sequence);
UpdateStatus?.Invoke(string.Format(Localization.Core.Setting_flags_for_track_0, track.Sequence));
outputOptical.WriteSectorTag(new[]
{
kvp.Value
},
kvp.Key,
SectorTagType.CdTrackFlags);
outputOptical.WriteSectorTag([kvp.Value], kvp.Key, SectorTagType.CdTrackFlags);
}
// Set MCN
@@ -1108,16 +1103,15 @@ sealed partial class Dump
if(supportedSubchannel != MmcSubchannel.None && desiredSubchannel != MmcSubchannel.None)
{
subchannelExtents = new HashSet<int>();
subchannelExtents = [];
_resume.BadSubchannels ??= new List<int>();
_resume.BadSubchannels ??= [];
foreach(int sub in _resume.BadSubchannels) subchannelExtents.Add(sub);
if(_resume.NextBlock < blocks)
{
for(ulong i = _resume.NextBlock; i < blocks; i++) subchannelExtents.Add((int)i);
}
for(ulong i = _resume.NextBlock; i < blocks; i++)
subchannelExtents.Add((int)i);
}
if(_resume.NextBlock > 0)
@@ -1606,9 +1600,8 @@ sealed partial class Dump
supportsLongSectors);
foreach(Tuple<ulong, ulong> leadoutExtent in leadOutExtents.ToArray())
{
for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++) subchannelExtents.Remove((int)e);
}
for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++)
subchannelExtents.Remove((int)e);
if(subchannelExtents.Count > 0 && _retryPasses > 0 && _retrySubchannel)
{
@@ -1655,7 +1648,7 @@ sealed partial class Dump
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
_resume.BadSubchannels = new List<int>();
_resume.BadSubchannels = [];
_resume.BadSubchannels.AddRange(subchannelExtents);
_resume.BadSubchannels.Sort();

View File

@@ -182,15 +182,15 @@ partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
Pages =
[
new Modes.ModePage
{
Page = 0x01,
Subpage = 0x00,
PageResponse = Modes.EncodeModePage_01_MMC(pgMmc)
}
}
]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -219,7 +219,7 @@ partial class Dump
InitProgress?.Invoke();
cdRepeatRetry:
ulong[] tmpArray = _resume.BadBlocks.ToArray();
List<ulong> sectorsNotEvenPartial = new();
List<ulong> sectorsNotEvenPartial = [];
for(var i = 0; i < tmpArray.Length; i++)
{
@@ -469,9 +469,8 @@ partial class Dump
// MEDIUM ERROR, retry with ignore error below
if(decSense is { ASC: 0x11 })
{
if(!sectorsNotEvenPartial.Contains(badSector)) sectorsNotEvenPartial.Add(badSector);
}
if(!sectorsNotEvenPartial.Contains(badSector))
sectorsNotEvenPartial.Add(badSector);
}
// Because one block has been partially used to fix the offset
@@ -587,15 +586,15 @@ partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
Pages =
[
new Modes.ModePage
{
Page = 0x01,
Subpage = 0x00,
PageResponse = Modes.EncodeModePage_01_MMC(pgMmc)
}
}
]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -717,10 +716,7 @@ partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
currentModePage.Value
}
Pages = [currentModePage.Value]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -778,7 +774,7 @@ partial class Dump
cdRepeatRetry:
_resume.BadSubchannels = new List<int>();
_resume.BadSubchannels = [];
_resume.BadSubchannels.AddRange(subchannelExtents);
_resume.BadSubchannels.Sort();

View File

@@ -48,7 +48,7 @@ partial class Dump
HashSet<int> subchannelExtents, SubchannelLog subLog, bool supportsLongSectors,
Dictionary<byte, byte> trackFlags, Track[] tracks)
{
List<ulong> runOutSectors = new();
List<ulong> runOutSectors = [];
if(_outputPlugin is not IWritableOpticalImage outputOptical) return;

View File

@@ -68,7 +68,7 @@ partial class Dump
byte[] cmdBuf; // Data buffer
const uint sectorSize = 2352; // Full sector size
bool sense; // Sense indicator
List<Track> trackList = new(); // Tracks in disc
List<Track> trackList = []; // Tracks in disc
byte[] tmpBuf; // Temporary buffer
toc = null;
lastSector = 0;

View File

@@ -1131,9 +1131,9 @@ partial class Dump
case MediaTagType.Xbox_SecuritySector:
sidecar.OpticalDiscs[0].Xbox ??= new Xbox();
sidecar.OpticalDiscs[0].Xbox.SecuritySectors = new List<XboxSecuritySector>
{
new()
sidecar.OpticalDiscs[0].Xbox.SecuritySectors =
[
new XboxSecuritySector
{
RequestNumber = 0,
RequestVersion = 1,
@@ -1144,7 +1144,7 @@ partial class Dump
Checksums = Checksum.GetChecksums(tag)
}
}
};
];
break;
case MediaTagType.Xbox_PFI:
@@ -1206,27 +1206,27 @@ partial class Dump
break;
case MediaTagType.CD_FirstTrackPregap:
sidecar.OpticalDiscs[0].FirstTrackPregrap = new List<Border>
{
new()
sidecar.OpticalDiscs[0].FirstTrackPregrap =
[
new Border
{
Image = outputPath,
Size = (ulong)tag.Length,
Checksums = Checksum.GetChecksums(tag)
}
};
];
break;
case MediaTagType.CD_LeadIn:
sidecar.OpticalDiscs[0].LeadIn = new List<Border>
{
new()
sidecar.OpticalDiscs[0].LeadIn =
[
new Border
{
Image = outputPath,
Size = (ulong)tag.Length,
Checksums = Checksum.GetChecksums(tag)
}
};
];
break;
}

View File

@@ -111,7 +111,7 @@ partial class Dump
sidecar = _preSidecar;
}
List<(ulong start, string type)> filesystems = new();
List<(ulong start, string type)> filesystems = [];
if(sidecar.OpticalDiscs[0].Track != null)
{

View File

@@ -613,15 +613,15 @@ partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
Pages =
[
new Modes.ModePage
{
Page = 0x01,
Subpage = 0x00,
PageResponse = Modes.EncodeModePage_01(pg)
}
}
]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -724,10 +724,7 @@ partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
currentModePage.Value
}
Pages = [currentModePage.Value]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -840,7 +837,7 @@ partial class Dump
sidecar = _preSidecar;
}
List<(ulong start, string type)> filesystems = new();
List<(ulong start, string type)> filesystems = [];
if(sidecar.BlockMedias[0].FileSystemInformation != null)
{

View File

@@ -497,15 +497,15 @@ public partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
Pages =
[
new Modes.ModePage
{
Page = 0x01,
Subpage = 0x00,
PageResponse = Modes.EncodeModePage_01(pg)
}
}
]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -616,10 +616,7 @@ public partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
currentModePage.Value
}
Pages = [currentModePage.Value]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -732,7 +729,7 @@ public partial class Dump
sidecar = _preSidecar;
}
List<(ulong start, string type)> filesystems = new();
List<(ulong start, string type)> filesystems = [];
if(sidecar.BlockMedias[0].FileSystemInformation != null)
{

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
@@ -186,19 +185,18 @@ public partial class Dump
_dumpStopwatch.Restart();
double imageWriteDuration = 0;
outputOptical.SetTracks(new List<Track>
{
new()
{
BytesPerSector = (int)blockSize,
EndSector = blocks - 1,
Sequence = 1,
RawBytesPerSector = (int)blockSize,
SubchannelType = TrackSubchannelType.None,
Session = 1,
Type = TrackType.Data
}
});
outputOptical.SetTracks([
new Track
{
BytesPerSector = (int)blockSize,
EndSector = blocks - 1,
Sequence = 1,
RawBytesPerSector = (int)blockSize,
SubchannelType = TrackSubchannelType.None,
Session = 1,
Type = TrackType.Data
}
]);
DumpHardware currentTry = null;
ExtentsULong extents = null;
@@ -517,15 +515,15 @@ public partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
Pages =
[
new Modes.ModePage
{
Page = 0x01,
Subpage = 0x00,
PageResponse = Modes.EncodeModePage_01(pg)
}
}
]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -635,10 +633,7 @@ public partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
currentModePage.Value
}
Pages = [currentModePage.Value]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Metadata;
@@ -179,9 +178,9 @@ static class ResumeSupport
{
resume = new Resume
{
Tries = new List<DumpHardware>(),
Tries = [],
CreationDate = DateTime.UtcNow,
BadBlocks = new List<ulong>(),
BadBlocks = [],
LastBlock = isTape ? 0 : blocks - 1,
Tape = isTape
};

View File

@@ -285,9 +285,8 @@ partial class Dump
Modes.DecodedMode? decMode = null;
if(!sense && !_dev.Error)
{
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType);
}
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue)
decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType);
UpdateStatus?.Invoke(Localization.Core.Requesting_MODE_SENSE_6);
@@ -315,9 +314,8 @@ partial class Dump
if(sense || _dev.Error) sense = _dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration);
if(!sense && !_dev.Error)
{
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType);
}
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType);
// TODO: Check partitions page
if(decMode.HasValue)
@@ -1530,7 +1528,7 @@ partial class Dump
sidecar = _preSidecar;
}
List<(ulong start, string type)> filesystems = new();
List<(ulong start, string type)> filesystems = [];
if(sidecar.BlockMedias[0].FileSystemInformation != null)
{

View File

@@ -126,12 +126,7 @@ partial class Dump
if(key.All(static k => k == 0))
{
outputFormat.WriteSectorTag(new byte[]
{
0, 0, 0, 0, 0
},
i + j,
SectorTagType.DvdTitleKeyDecrypted);
outputFormat.WriteSectorTag([0, 0, 0, 0, 0], i + j, SectorTagType.DvdTitleKeyDecrypted);
_resume.MissingTitleKeys?.Remove(i + j);

View File

@@ -135,12 +135,7 @@ partial class Dump
if(titleKey.HasValue)
{
outputFormat.WriteSectorTag(new[]
{
titleKey.Value.CMI
},
i + j,
SectorTagType.DvdSectorCmi);
outputFormat.WriteSectorTag([titleKey.Value.CMI], i + j, SectorTagType.DvdSectorCmi);
}
else
continue;
@@ -149,19 +144,9 @@ partial class Dump
// not encrypted even if the CMI says it is.
if(titleKey.Value.Key.All(static k => k == 0))
{
outputFormat.WriteSectorTag(new byte[]
{
0, 0, 0, 0, 0
},
i + j,
SectorTagType.DvdSectorTitleKey);
outputFormat.WriteSectorTag([0, 0, 0, 0, 0], i + j, SectorTagType.DvdSectorTitleKey);
outputFormat.WriteSectorTag(new byte[]
{
0, 0, 0, 0, 0
},
i + j,
SectorTagType.DvdTitleKeyDecrypted);
outputFormat.WriteSectorTag([0, 0, 0, 0, 0], i + j, SectorTagType.DvdTitleKeyDecrypted);
_resume.MissingTitleKeys.Remove(i + j);

View File

@@ -485,7 +485,7 @@ partial class Dump
UpdateStatus?.Invoke(Localization.Core.Building_track_map);
_dumpLog.WriteLine(Localization.Core.Building_track_map);
List<Track> tracks = new();
List<Track> tracks = [];
for(ushort tno = discInformation.Value.FirstTrackNumber;
tno <= discInformation?.LastTrackLastSession;
@@ -597,19 +597,18 @@ partial class Dump
}
else
{
opticalPlugin.SetTracks(new List<Track>
{
new()
{
BytesPerSector = (int)blockSize,
EndSector = blocks - 1,
Sequence = 1,
RawBytesPerSector = (int)blockSize,
SubchannelType = TrackSubchannelType.None,
Session = 1,
Type = TrackType.Data
}
});
opticalPlugin.SetTracks([
new Track
{
BytesPerSector = (int)blockSize,
EndSector = blocks - 1,
Sequence = 1,
RawBytesPerSector = (int)blockSize,
SubchannelType = TrackSubchannelType.None,
Session = 1,
Type = TrackType.Data
}
]);
}
}
}
@@ -714,19 +713,18 @@ partial class Dump
UpdateStatus?.Invoke(Localization.Core
.Creating_single_track_as_could_not_retrieve_track_list_from_drive);
(outputFormat as IWritableOpticalImage)?.SetTracks(new List<Track>
{
new()
{
BytesPerSector = (int)blockSize,
EndSector = blocks - 1,
Sequence = 1,
RawBytesPerSector = (int)blockSize,
SubchannelType = TrackSubchannelType.None,
Session = 1,
Type = TrackType.Data
}
});
(outputFormat as IWritableOpticalImage)?.SetTracks([
new Track
{
BytesPerSector = (int)blockSize,
EndSector = blocks - 1,
Sequence = 1,
RawBytesPerSector = (int)blockSize,
SubchannelType = TrackSubchannelType.None,
Session = 1,
Type = TrackType.Data
}
]);
}
}
@@ -816,7 +814,7 @@ partial class Dump
(CopyrightType)cmi[0] == CopyrightType.CSS)
{
UpdateStatus?.Invoke(Localization.Core.Title_keys_dumping_is_enabled_This_will_be_very_slow);
_resume.MissingTitleKeys ??= new List<ulong>(Enumerable.Range(0, (int)blocks).Select(n => (ulong)n));
_resume.MissingTitleKeys ??= [..Enumerable.Range(0, (int)blocks).Select(n => (ulong)n)];
}
if(_dev.ScsiType == PeripheralDeviceTypes.OpticalDevice)
@@ -1431,7 +1429,7 @@ partial class Dump
}
}
List<(ulong start, string type)> filesystems = new();
List<(ulong start, string type)> filesystems = [];
if(sidecar.BlockMedias[0].FileSystemInformation != null)
{

View File

@@ -174,15 +174,15 @@ partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
Pages =
[
new Modes.ModePage
{
Page = 0x01,
Subpage = 0x00,
PageResponse = Modes.EncodeModePage_01_MMC(pgMmc)
}
}
]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -207,15 +207,15 @@ partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
Pages =
[
new Modes.ModePage
{
Page = 0x01,
Subpage = 0x00,
PageResponse = Modes.EncodeModePage_01(pg)
}
}
]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -340,10 +340,7 @@ partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
currentModePage.Value
}
Pages = [currentModePage.Value]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -408,30 +405,15 @@ partial class Dump
if(!titleKey.HasValue) continue;
outputFormat.WriteSectorTag(new[]
{
titleKey.Value.CMI
},
missingKey,
SectorTagType.DvdSectorCmi);
outputFormat.WriteSectorTag([titleKey.Value.CMI], missingKey, SectorTagType.DvdSectorCmi);
// If the CMI bit is 1, the sector is using copy protection, else it is not
// If the decoded title key is zeroed, there should be no copy protection
if((titleKey.Value.CMI & 0x80) >> 7 == 0 || titleKey.Value.Key.All(k => k == 0))
{
outputFormat.WriteSectorTag(new byte[]
{
0, 0, 0, 0, 0
},
missingKey,
SectorTagType.DvdSectorTitleKey);
outputFormat.WriteSectorTag([0, 0, 0, 0, 0], missingKey, SectorTagType.DvdSectorTitleKey);
outputFormat.WriteSectorTag(new byte[]
{
0, 0, 0, 0, 0
},
missingKey,
SectorTagType.DvdTitleKeyDecrypted);
outputFormat.WriteSectorTag([0, 0, 0, 0, 0], missingKey, SectorTagType.DvdTitleKeyDecrypted);
_resume.MissingTitleKeys.Remove(missingKey);

View File

@@ -623,19 +623,18 @@ partial class Dump
_mediaGraph?.PaintSectorsBad(_resume.BadBlocks);
}
(outputFormat as IWritableOpticalImage).SetTracks(new List<Track>
{
new()
{
BytesPerSector = (int)blockSize,
EndSector = blocks - 1,
Sequence = 1,
RawBytesPerSector = (int)blockSize,
SubchannelType = TrackSubchannelType.None,
Session = 1,
Type = TrackType.Data
}
});
(outputFormat as IWritableOpticalImage).SetTracks([
new Track
{
BytesPerSector = (int)blockSize,
EndSector = blocks - 1,
Sequence = 1,
RawBytesPerSector = (int)blockSize,
SubchannelType = TrackSubchannelType.None,
Session = 1,
Type = TrackType.Data
}
]);
ulong currentSector = _resume.NextBlock;
@@ -785,11 +784,7 @@ partial class Dump
i += _skip - blocksToRead;
string[] senseLines = Sense.PrettifySense(senseBuf)
.Split(new[]
{
Environment.NewLine
},
StringSplitOptions.RemoveEmptyEntries);
.Split([Environment.NewLine], StringSplitOptions.RemoveEmptyEntries);
foreach(string senseLine in senseLines) _dumpLog.WriteLine(senseLine);
@@ -997,11 +992,7 @@ partial class Dump
l1 += _skip - blocksToRead;
string[] senseLines = Sense.PrettifySense(senseBuf)
.Split(new[]
{
Environment.NewLine
},
StringSplitOptions.RemoveEmptyEntries);
.Split([Environment.NewLine], StringSplitOptions.RemoveEmptyEntries);
foreach(string senseLine in senseLines) _dumpLog.WriteLine(senseLine);
}
@@ -1152,12 +1143,11 @@ partial class Dump
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
{
List<ulong> tmpList = new();
List<ulong> tmpList = [];
foreach(ulong ur in _resume.BadBlocks)
{
for(ulong i = ur; i < ur + blocksToRead; i++) tmpList.Add(i);
}
for(ulong i = ur; i < ur + blocksToRead; i++)
tmpList.Add(i);
tmpList.Sort();
@@ -1245,15 +1235,15 @@ partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
Pages =
[
new Modes.ModePage
{
Page = 0x01,
Subpage = 0x00,
PageResponse = Modes.EncodeModePage_01_MMC(pgMmc)
}
}
]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -1368,10 +1358,7 @@ partial class Dump
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(),
Pages = new[]
{
currentModePage.Value
}
Pages = [currentModePage.Value]
};
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
@@ -1465,13 +1452,13 @@ partial class Dump
var layers = new Layers
{
Type = LayerType.OTP,
Sectors = new List<Sectors>
{
new()
Sectors =
[
new Sectors
{
Value = layerBreak
}
}
]
};
WriteOpticalSidecar(blockSize, blocks, dskType, layers, mediaTags, 1, out totalChkDuration, null);

View File

@@ -50,8 +50,8 @@ public sealed partial class DeviceReport
AtaErrorRegistersChs errorChs = new();
AtaErrorRegistersLba28 errorLba = new();
AtaErrorRegistersLba48 errorLba48 = new();
byte[] buffer = Array.Empty<byte>();
byte[] readBuf = Array.Empty<byte>();
byte[] buffer = [];
byte[] readBuf = [];
var mediaTest = new TestedMedia
{
@@ -536,7 +536,7 @@ public sealed partial class DeviceReport
public TestedMedia ReportAta(Identify.IdentifyDevice ataId)
{
var sense = true;
byte[] readBuf = Array.Empty<byte>();
byte[] readBuf = [];
AtaErrorRegistersChs errorChs = new();
AtaErrorRegistersLba28 errorLba = new();
AtaErrorRegistersLba48 errorLba48 = new();

View File

@@ -76,7 +76,7 @@ public sealed partial class DeviceReport
public MmcFeatures ReportMmcFeatures()
{
var sense = true;
byte[] buffer = Array.Empty<byte>();
byte[] buffer = [];
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -580,8 +580,8 @@ public sealed partial class DeviceReport
bool tryMediaTekF106)
{
var sense = true;
byte[] buffer = Array.Empty<byte>();
byte[] senseBuffer = Array.Empty<byte>();
byte[] buffer = [];
byte[] senseBuffer = [];
var mediaTest = new TestedMedia();
Spectre.ProgressSingleSpinner(ctx =>

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
using System;
using System.Linq;
using Aaru.CommonTypes.Metadata;
using Aaru.Decoders.SCSI;
@@ -48,7 +47,7 @@ public sealed partial class DeviceReport
{
var report = new Ssc();
var sense = true;
byte[] buffer = Array.Empty<byte>();
byte[] buffer = [];
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -156,7 +155,7 @@ public sealed partial class DeviceReport
{
var seqTest = new TestedSequentialMedia();
var sense = true;
byte[] buffer = Array.Empty<byte>();
byte[] buffer = [];
Modes.DecodedMode? decMode = null;

View File

@@ -51,7 +51,7 @@ public sealed partial class DeviceReport
public Scsi ReportScsiInquiry()
{
var sense = true;
byte[] buffer = Array.Empty<byte>();
byte[] buffer = [];
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -96,7 +96,7 @@ public sealed partial class DeviceReport
public List<ScsiPage> ReportEvpdPages(string vendor)
{
var sense = false;
byte[] buffer = Array.Empty<byte>();
byte[] buffer = [];
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -110,7 +110,7 @@ public sealed partial class DeviceReport
if(evpdPages is not { Length: > 0 }) return null;
List<ScsiPage> evpds = new();
List<ScsiPage> evpds = [];
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -487,7 +487,7 @@ public sealed partial class DeviceReport
if(decMode.Value.Pages == null) return;
List<ScsiPage> modePages = new();
List<ScsiPage> modePages = [];
foreach(Modes.ModePage page in decMode.Value.Pages)
{
@@ -512,8 +512,8 @@ public sealed partial class DeviceReport
{
var mediaTest = new TestedMedia();
var sense = true;
byte[] buffer = Array.Empty<byte>();
byte[] senseBuffer = Array.Empty<byte>();
byte[] buffer = [];
byte[] senseBuffer = [];
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -884,8 +884,8 @@ public sealed partial class DeviceReport
public TestedMedia ReportScsi()
{
var sense = true;
byte[] buffer = Array.Empty<byte>();
byte[] senseBuffer = Array.Empty<byte>();
byte[] buffer = [];
byte[] senseBuffer = [];
var capabilities = new TestedMedia
{

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2024 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Metadata;
using Aaru.Console;
@@ -46,10 +45,10 @@ public sealed partial class DeviceReport
{
var report = new MmcSd();
var sense = true;
byte[] cid = Array.Empty<byte>();
byte[] csd = Array.Empty<byte>();
byte[] ecsd = Array.Empty<byte>();
byte[] scr = Array.Empty<byte>();
byte[] cid = [];
byte[] csd = [];
byte[] ecsd = [];
byte[] scr = [];
Spectre.ProgressSingleSpinner(ctx =>
{

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Aaru.CommonTypes.Structs.Devices.ATA;
using Aaru.Core.Logging;
using Humanizer;
@@ -105,7 +104,7 @@ public sealed partial class MediaScan
double currentSpeed = 0;
results.MaxSpeed = double.MinValue;
results.MinSpeed = double.MaxValue;
results.UnreadableSectors = new List<ulong>();
results.UnreadableSectors = [];
results.SeekMax = double.MinValue;
results.SeekMin = double.MaxValue;
results.SeekTotal = 0;

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Threading;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
@@ -284,7 +283,7 @@ public sealed partial class MediaScan
double currentSpeed = 0;
results.MaxSpeed = double.MinValue;
results.MinSpeed = double.MaxValue;
results.UnreadableSectors = new List<ulong>();
results.UnreadableSectors = [];
if(compactDisc)
{

View File

@@ -33,7 +33,6 @@
// ReSharper disable JoinDeclarationAndInitializer
using System;
using System.Collections.Generic;
using Aaru.Core.Logging;
using Aaru.Decoders.MMC;
using Aaru.Decoders.SecureDigital;
@@ -206,7 +205,7 @@ public sealed partial class MediaScan
double currentSpeed = 0;
results.MaxSpeed = double.MinValue;
results.MinSpeed = double.MaxValue;
results.UnreadableSectors = new List<ulong>();
results.UnreadableSectors = [];
results.SeekMax = double.MinValue;
results.SeekMin = double.MaxValue;
results.SeekTotal = 0;

View File

@@ -80,7 +80,7 @@ public sealed class Entropy
/// <returns>Calculated entropy</returns>
public EntropyResults[] CalculateTracksEntropy(bool duplicatedSectors)
{
List<EntropyResults> entropyResults = new();
List<EntropyResults> entropyResults = [];
if(_inputFormat is not IOpticalMediaImage opticalMediaImage)
{
@@ -111,7 +111,7 @@ public sealed class Entropy
var entTable = new ulong[256];
ulong trackSize = 0;
List<string> uniqueSectorsPerTrack = new();
List<string> uniqueSectorsPerTrack = [];
trackEntropy.Sectors = currentTrack.EndSector - currentTrack.StartSector + 1;
@@ -197,7 +197,7 @@ public sealed class Entropy
var entTable = new ulong[256];
ulong diskSize = 0;
List<string> uniqueSectors = new();
List<string> uniqueSectors = [];
entropy.Sectors = mediaImage.Info.Sectors;
AaruConsole.WriteLine(Localization.Core.Sectors_0, entropy.Sectors);

View File

@@ -624,7 +624,7 @@ public sealed class Spiral : IMediaGraph
static List<SKPoint> GetSpiralPoints(SKPoint center, float minRadius, float maxRadius, float a)
{
// Initialize a list to store the points of the spiral.
List<SKPoint> points = new();
List<SKPoint> points = [];
const float dtheta = (float)(0.5f * Math.PI / 180);
for(float theta = 0;; theta += dtheta)

View File

@@ -75,8 +75,8 @@ public sealed class ErrorLog
}
else
{
List<string> error = new();
List<string> status = new();
List<string> error = [];
List<string> status = [];
if((registers.Status & 0x01) == 0x01) status.Add("ERR");
@@ -141,8 +141,8 @@ public sealed class ErrorLog
}
else
{
List<string> error = new();
List<string> status = new();
List<string> error = [];
List<string> status = [];
if((registers.Status & 0x01) == 0x01) status.Add("ERR");
@@ -201,8 +201,8 @@ public sealed class ErrorLog
}
else
{
List<string> error = new();
List<string> status = new();
List<string> error = [];
List<string> status = [];
if((registers.Status & 0x01) == 0x01) status.Add("ERR");
@@ -259,8 +259,8 @@ public sealed class ErrorLog
}
else
{
List<string> error = new();
List<string> status = new();
List<string> error = [];
List<string> status = [];
if((registers.Status & 0x01) == 0x01) status.Add("ERR");

View File

@@ -132,9 +132,8 @@ public static class CompactDisc
if(deSub[p] != 0 && deSub[p] != 255) pOk = false;
for(var w = 0; w < 8; w++)
{
if((deSub[p] >> w & 1) > 0) pWeight++;
}
if((deSub[p] >> w & 1) > 0)
pWeight++;
}
// This seems to be a somewhat common pattern
@@ -178,13 +177,11 @@ public static class CompactDisc
if(!pOk && fixSubchannel)
{
if(pWeight >= 48)
{
for(int p = subPos; p < subPos + 12; p++) deSub[p] = 255;
}
for(int p = subPos; p < subPos + 12; p++)
deSub[p] = 255;
else
{
for(int p = subPos; p < subPos + 12; p++) deSub[p] = 0;
}
for(int p = subPos; p < subPos + 12; p++)
deSub[p] = 0;
pOk = true;
@fixed = true;
@@ -318,7 +315,7 @@ public static class CompactDisc
out List<ulong> newPregapSectors, ulong sectorAddress)
{
var status = false;
newPregapSectors = new List<ulong>();
newPregapSectors = [];
// Check subchannel
for(var subPos = 0; subPos < deSub.Length; subPos += 96)

View File

@@ -66,30 +66,24 @@ public static class MMC
const string MODULE_NAME = "Media detection";
static readonly byte[] _ps3Id =
{
[
0x50, 0x6C, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x33, 0x00, 0x00, 0x00, 0x00
};
];
static readonly byte[] _ps4Id =
{
[
0x50, 0x6C, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x34, 0x00, 0x00, 0x00, 0x00
};
];
static readonly byte[] _ps5Id =
{
[
0x50, 0x6C, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x35, 0x00, 0x00, 0x00, 0x00
};
];
static readonly byte[] _operaId =
{
0x01, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x01
};
static readonly byte[] _operaId = [0x01, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x01];
// Only present on bootable CDs, but those make more than 99% of all available
static readonly byte[] _fmTownsBootId =
{
0x49, 0x50, 0x4C, 0x34, 0xEB, 0x55, 0x06
};
static readonly byte[] _fmTownsBootId = [0x49, 0x50, 0x4C, 0x34, 0xEB, 0x55, 0x06];
/// <summary>Present on first two seconds of second track, says "COPYRIGHT BANDAI"</summary>
static readonly byte[] _playdiaCopyright = "COPYRIGHT BANDAI"u8.ToArray();
@@ -100,7 +94,7 @@ public static class MMC
/// <summary>This is some kind of header. Every 10 bytes there's an audio byte.</summary>
static readonly byte[] _videoNowColorFrameMarker =
{
[
0x81, 0xE3, 0xE3, 0xC7, 0xC7, 0x81, 0x81, 0xE3, 0xC7, 0x00, 0x81, 0xE3, 0xE3, 0xC7, 0xC7, 0x81, 0x81, 0xE3,
0xC7, 0x00, 0x81, 0xE3, 0xE3, 0xC7, 0xC7, 0x81, 0x81, 0xE3, 0xC7, 0x00, 0x81, 0xE3, 0xE3, 0xC7, 0xC7, 0x81,
0x81, 0xE3, 0xC7, 0x00, 0x81, 0xE3, 0xE3, 0xC7, 0xC7, 0x81, 0x81, 0xE3, 0xC7, 0x00, 0x81, 0xE3, 0xE3, 0xC7,
@@ -124,16 +118,13 @@ public static class MMC
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0x00
};
];
static bool IsData(byte[] sector)
{
if(sector?.Length != 2352) return false;
byte[] syncMark =
{
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00
};
byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
var testMark = new byte[12];
Array.Copy(sector, 0, testMark, 0, 12);
@@ -147,10 +138,7 @@ public static class MMC
if(sector?.Length != 2352) return false;
byte[] syncMark =
{
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00
};
byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
var testMark = new byte[12];
@@ -205,10 +193,7 @@ public static class MMC
{
if(sector16?.Length != 2352) return false;
byte[] cdiMark =
{
0x01, 0x43, 0x44, 0x2D
};
byte[] cdiMark = [0x01, 0x43, 0x44, 0x2D];
bool isData = IsData(sector0);
@@ -2264,7 +2249,7 @@ public static class MMC
if(isoSector.Length < 2048) return;
List<string> rootEntries = new();
List<string> rootEntries = [];
uint ngcdIplStart = 0;
uint ngcdIplLength = 0;
uint vcdStart = 0;

View File

@@ -92,10 +92,7 @@ public static class CompactDisc
if(dataTrack != null)
{
// Build sync
sectorSync = new byte[]
{
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00
};
sectorSync = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
tmpBuf = new byte[sectorSync.Length];
@@ -303,11 +300,11 @@ public static class CompactDisc
second ^= 0x80;
// Build sync
sectorSync = new byte[]
{
sectorSync =
[
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, (byte)minute, (byte)second,
(byte)frame
};
];
tmpBuf = new byte[sectorSync.Length];

View File

@@ -50,9 +50,9 @@ public static class Partitions
public static List<Partition> GetAll(IMediaImage image)
{
PluginRegister plugins = PluginRegister.Singleton;
List<Partition> foundPartitions = new();
List<Partition> childPartitions = new();
List<ulong> checkedLocations = new();
List<Partition> foundPartitions = [];
List<Partition> childPartitions = [];
List<ulong> checkedLocations = [];
var tapeImage = image as ITapeImage;
var partitionableImage = image as IPartitionableMediaImage;
@@ -129,7 +129,7 @@ public static class Partitions
continue;
}
List<Partition> children = new();
List<Partition> children = [];
foreach(IPartition plugin in plugins.Partitions.Values)
{
@@ -221,7 +221,7 @@ public static class Partitions
{
if(partitions == null || partitions.Count == 0) return;
List<string> schemes = new();
List<string> schemes = [];
foreach(Partition part in partitions.Where(part => !schemes.Contains(part.Scheme))) schemes.Add(part.Scheme);

View File

@@ -140,7 +140,7 @@ public static class Remote
if(!create)
{
List<DateTime> latestAll = new();
List<DateTime> latestAll = [];
if(mctx.UsbVendors.Any()) latestAll.Add(mctx.UsbVendors.Max(v => v.ModifiedWhen));
@@ -284,7 +284,7 @@ public static class Remote
ProgressTask task = ctx.AddTask(Localization.Core.Adding_known_iNES_NES_2_0_headers);
task.MaxValue = sync.NesHeaders?.Count ?? 0;
foreach(NesHeaderDto header in sync.NesHeaders ?? new List<NesHeaderDto>())
foreach(NesHeaderDto header in sync.NesHeaders ?? [])
{
task.Increment(1);
@@ -491,7 +491,7 @@ public static class Remote
ProgressTask task = ctx.AddTask(Localization.Core.Updating_known_iNES_NES_2_0_headers);
task.MaxValue = sync.Offsets.Count;
sync.NesHeaders ??= new List<NesHeaderDto>();
sync.NesHeaders ??= [];
foreach(NesHeaderDto header in sync.NesHeaders)
{

View File

@@ -58,9 +58,9 @@ public sealed partial class Sidecar
List<CommonTypes.AaruMetadata.Checksum> imgChecksums, ref Metadata sidecar,
Encoding encoding)
{
sidecar.AudioMedias = new List<AudioMedia>
{
new()
sidecar.AudioMedias =
[
new AudioMedia
{
Checksums = imgChecksums,
Image = new Image
@@ -75,7 +75,7 @@ public sealed partial class Sidecar
Title = image.Info.MediaTitle
}
}
};
];
if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0)
{

View File

@@ -69,9 +69,9 @@ public sealed partial class Sidecar
{
if(_aborted) return;
sidecar.BlockMedias = new List<BlockMedia>
{
new()
sidecar.BlockMedias =
[
new BlockMedia
{
Checksums = imgChecksums,
Image = new Image
@@ -86,7 +86,7 @@ public sealed partial class Sidecar
Title = image.Info.MediaTitle
}
}
};
];
if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0)
{
@@ -185,7 +185,9 @@ public sealed partial class Sidecar
$"{vers.MajorVersion}.{vers.MinorVersion}";
sidecar.BlockMedias[0].Pcmcia.AdditionalInformation =
new List<string>(vers.AdditionalInformation);
[
..vers.AdditionalInformation
];
}
break;
@@ -453,7 +455,7 @@ public sealed partial class Sidecar
if(image is ITapeImage { IsTape: true } tapeImage)
{
List<TapePartition> tapePartitions = new();
List<TapePartition> tapePartitions = [];
foreach(CommonTypes.Structs.TapePartition tapePartition in tapeImage.TapePartitions)
{
@@ -549,7 +551,7 @@ public sealed partial class Sidecar
EndProgress2();
}
List<TapeFile> filesInPartition = new();
List<TapeFile> filesInPartition = [];
foreach(CommonTypes.Structs.TapeFile tapeFile in
tapeImage.Files.Where(f => f.Partition == tapePartition.Number))
@@ -675,7 +677,7 @@ public sealed partial class Sidecar
List<Partition> partitions = Partitions.GetAll(image);
Partitions.AddSchemesToStats(partitions);
sidecar.BlockMedias[0].FileSystemInformation = new List<CommonTypes.AaruMetadata.Partition>();
sidecar.BlockMedias[0].FileSystemInformation = [];
if(partitions.Count > 0)
{
@@ -693,7 +695,7 @@ public sealed partial class Sidecar
Type = partition.Type
};
List<FileSystem> lstFs = new();
List<FileSystem> lstFs = [];
foreach(IFilesystem fs in plugins.Filesystems.Values)
{
@@ -755,7 +757,7 @@ public sealed partial class Sidecar
Size = image.Info.Sectors * image.Info.SectorSize
};
List<FileSystem> lstFs = new();
List<FileSystem> lstFs = [];
foreach(IFilesystem fs in plugins.Filesystems.Values)
{
@@ -992,7 +994,7 @@ public sealed partial class Sidecar
{
if(scpImage.Header.end + 1 >= image.Info.Cylinders)
{
List<BlockTrack> scpBlockTrackTypes = new();
List<BlockTrack> scpBlockTrackTypes = [];
ulong currentSector = 0;
Stream scpStream = scpFilter.GetDataForkStream();
@@ -1106,7 +1108,7 @@ public sealed partial class Sidecar
{
if(kfImage.Info.Cylinders >= image.Info.Cylinders)
{
List<BlockTrack> kfBlockTrackTypes = new();
List<BlockTrack> kfBlockTrackTypes = [];
ulong currentSector = 0;
@@ -1200,7 +1202,7 @@ public sealed partial class Sidecar
{
if(dfiImage.Info.Cylinders >= image.Info.Cylinders)
{
List<BlockTrack> dfiBlockTrackTypes = new();
List<BlockTrack> dfiBlockTrackTypes = [];
ulong currentSector = 0;
Stream dfiStream = dfiFilter.GetDataForkStream();

View File

@@ -48,9 +48,9 @@ public sealed partial class Sidecar
{
_sidecar = new Metadata
{
BlockMedias = new List<BlockMedia>
{
new()
BlockMedias =
[
new BlockMedia
{
Image = new Image
{
@@ -65,9 +65,9 @@ public sealed partial class Sidecar
},
PhysicalBlockSize = blockSize,
LogicalBlockSize = blockSize,
TapeInformation = new List<TapePartition>
{
new()
TapeInformation =
[
new TapePartition
{
Image = new Image
{
@@ -75,9 +75,9 @@ public sealed partial class Sidecar
Value = folderName
}
}
}
]
}
}
]
};
if(_aborted) return _sidecar;
@@ -85,7 +85,7 @@ public sealed partial class Sidecar
ulong currentBlock = 0;
ulong totalSize = 0;
var tapeWorker = new Checksum();
List<TapeFile> tapeFiles = new();
List<TapeFile> tapeFiles = [];
UpdateStatus(Localization.Core.Hashing_files);

View File

@@ -51,8 +51,8 @@ public sealed partial class Sidecar
if(ret != ErrorNumber.NoError) return null;
List<Directory> directories = new();
List<ContentsFile> files = new();
List<Directory> directories = [];
List<ContentsFile> files = [];
while(filesystem.ReadDir(node, out string dirent) == ErrorNumber.NoError && dirent is not null)
{
@@ -107,8 +107,8 @@ public sealed partial class Sidecar
if(ret != ErrorNumber.NoError) return null;
List<Directory> directories = new();
List<ContentsFile> files = new();
List<Directory> directories = [];
List<ContentsFile> files = [];
while(filesystem.ReadDir(node, out string dirent) == ErrorNumber.NoError && dirent is not null)
{
@@ -208,7 +208,7 @@ public sealed partial class Sidecar
if(ret != ErrorNumber.NoError) return file;
List<ExtendedAttribute> xattrTypes = new();
List<ExtendedAttribute> xattrTypes = [];
foreach(string xattr in xattrs)
{

View File

@@ -54,20 +54,20 @@ public sealed partial class Sidecar
/// <param name="imgChecksums">List of image checksums</param>
/// <param name="sidecar">Metadata sidecar</param>
/// <param name="encoding">Encoding to be used for filesystem plugins</param>
static void LinearMedia(IByteAddressableImage image, Guid filterId, string imagePath, FileInfo fi,
PluginRegister plugins, List<CommonTypes.AaruMetadata.Checksum> imgChecksums,
ref Metadata sidecar, Encoding encoding) => sidecar.LinearMedias = new List<LinearMedia>
{
new()
{
Checksums = imgChecksums,
Image = new Image
{
Format = image.Format,
Offset = 0,
Value = Path.GetFileName(imagePath)
},
Size = image.Info.Sectors
}
};
static void LinearMedia(IByteAddressableImage image, Guid filterId, string imagePath, FileInfo fi,
PluginRegister plugins, List<CommonTypes.AaruMetadata.Checksum> imgChecksums,
ref Metadata sidecar, Encoding encoding) => sidecar.LinearMedias =
[
new LinearMedia
{
Checksums = imgChecksums,
Image = new Image
{
Format = image.Format,
Offset = 0,
Value = Path.GetFileName(imagePath)
},
Size = image.Info.Sectors
}
];
}

View File

@@ -66,9 +66,9 @@ public sealed partial class Sidecar
{
if(_aborted) return;
sidecar.OpticalDiscs = new List<OpticalDisc>
{
new()
sidecar.OpticalDiscs =
[
new OpticalDisc
{
Checksums = imgChecksums,
Image = new Image
@@ -83,7 +83,7 @@ public sealed partial class Sidecar
Title = image.Info.MediaTitle
}
}
};
];
if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0)
{
@@ -234,7 +234,7 @@ public sealed partial class Sidecar
{
sidecar.OpticalDiscs[0].Tracks = new uint[1];
sidecar.OpticalDiscs[0].Tracks[0] = (uint)tracks.Count;
trksLst = new List<CommonTypes.AaruMetadata.Track>();
trksLst = [];
}
if(sidecar.OpticalDiscs[0].Dimensions == null && image.Info.MediaType != MediaType.Unknown)
@@ -512,7 +512,7 @@ public sealed partial class Sidecar
var trkPartitions = partitions.Where(p => p.Start >= trk.StartSector && p.End <= trk.EndSector).ToList();
xmlTrk.FileSystemInformation = new List<CommonTypes.AaruMetadata.Partition>();
xmlTrk.FileSystemInformation = [];
if(trkPartitions.Count > 0)
{
@@ -528,7 +528,7 @@ public sealed partial class Sidecar
Type = partition.Type
};
List<FileSystem> lstFs = new();
List<FileSystem> lstFs = [];
foreach(IFilesystem fs in plugins.Filesystems.Values)
{
@@ -579,7 +579,7 @@ public sealed partial class Sidecar
StartSector = xmlTrk.StartSector
};
List<FileSystem> lstFs = new();
List<FileSystem> lstFs = [];
var xmlPart = new Partition
{
@@ -691,18 +691,18 @@ public sealed partial class Sidecar
!string.IsNullOrEmpty(image.Info.DriveFirmwareRevision) ||
!string.IsNullOrEmpty(image.Info.DriveSerialNumber))
{
sidecar.OpticalDiscs[0].DumpHardware = new List<DumpHardware>
{
new()
sidecar.OpticalDiscs[0].DumpHardware =
[
new DumpHardware
{
Extents = new List<Extent>
{
new()
Extents =
[
new Extent
{
Start = 0,
End = image.Info.Sectors
}
},
],
Manufacturer = image.Info.DriveManufacturer,
Model = image.Info.DriveModel,
Firmware = image.Info.DriveFirmwareRevision,
@@ -713,7 +713,7 @@ public sealed partial class Sidecar
Version = image.Info.ApplicationVersion
}
}
};
];
}
}
}

View File

@@ -66,7 +66,7 @@ public sealed partial class Sidecar
_aborted = false;
var emptyChkWorker = new Checksum();
emptyChkWorker.Update(Array.Empty<byte>());
emptyChkWorker.Update([]);
_emptyChecksums = emptyChkWorker.End();
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
@@ -141,7 +140,7 @@ public static class Statistics
if(ctx.Commands.Any(c => !c.Synchronized))
{
dto.Commands = new List<NameValueStats>();
dto.Commands = [];
foreach(string nvs in ctx.Commands.Where(c => !c.Synchronized).Select(c => c.Name).Distinct())
{
@@ -155,7 +154,7 @@ public static class Statistics
if(ctx.Filesystems.Any(c => !c.Synchronized))
{
dto.Filesystems = new List<NameValueStats>();
dto.Filesystems = [];
foreach(string nvs in ctx.Filesystems.Where(c => !c.Synchronized)
.Select(c => c.Name)
@@ -171,7 +170,7 @@ public static class Statistics
if(ctx.Filters.Any(c => !c.Synchronized))
{
dto.Filters = new List<NameValueStats>();
dto.Filters = [];
foreach(string nvs in ctx.Filters.Where(c => !c.Synchronized).Select(c => c.Name).Distinct())
{
@@ -185,7 +184,7 @@ public static class Statistics
if(ctx.MediaFormats.Any(c => !c.Synchronized))
{
dto.MediaFormats = new List<NameValueStats>();
dto.MediaFormats = [];
foreach(string nvs in ctx.MediaFormats.Where(c => !c.Synchronized)
.Select(c => c.Name)
@@ -201,7 +200,7 @@ public static class Statistics
if(ctx.Partitions.Any(c => !c.Synchronized))
{
dto.Partitions = new List<NameValueStats>();
dto.Partitions = [];
foreach(string nvs in ctx.Partitions.Where(c => !c.Synchronized).Select(c => c.Name).Distinct())
{
@@ -215,7 +214,7 @@ public static class Statistics
if(ctx.Versions.Any(c => !c.Synchronized))
{
dto.Versions = new List<NameValueStats>();
dto.Versions = [];
foreach(string nvs in ctx.Versions.Where(c => !c.Synchronized).Select(c => c.Name).Distinct())
{
@@ -229,7 +228,7 @@ public static class Statistics
if(ctx.Medias.Any(c => !c.Synchronized))
{
dto.Medias = new List<MediaStats>();
dto.Medias = [];
foreach(string media in ctx.Medias.Where(c => !c.Synchronized).Select(c => c.Type).Distinct())
{
@@ -257,7 +256,7 @@ public static class Statistics
if(ctx.SeenDevices.Any(c => !c.Synchronized))
{
dto.Devices = new List<DeviceStats>();
dto.Devices = [];
foreach(DeviceStat device in ctx.SeenDevices.Where(c => !c.Synchronized))
{
@@ -274,7 +273,7 @@ public static class Statistics
if(ctx.OperatingSystems.Any(c => !c.Synchronized))
{
dto.OperatingSystems = new List<OsStats>();
dto.OperatingSystems = [];
foreach(string osName in ctx.OperatingSystems.Where(c => !c.Synchronized)
.Select(c => c.Name)
@@ -299,7 +298,7 @@ public static class Statistics
if(ctx.RemoteApplications.Any(c => !c.Synchronized))
{
dto.RemoteApplications = new List<OsStats>();
dto.RemoteApplications = [];
foreach(string remoteAppName in ctx.RemoteApplications.Where(c => !c.Synchronized)
.Select(c => c.Name)
@@ -325,7 +324,7 @@ public static class Statistics
if(ctx.RemoteArchitectures.Any(c => !c.Synchronized))
{
dto.RemoteArchitectures = new List<NameValueStats>();
dto.RemoteArchitectures = [];
foreach(string nvs in ctx.RemoteArchitectures.Where(c => !c.Synchronized)
.Select(c => c.Name)
@@ -341,7 +340,7 @@ public static class Statistics
if(ctx.RemoteOperatingSystems.Any(c => !c.Synchronized))
{
dto.RemoteOperatingSystems = new List<OsStats>();
dto.RemoteOperatingSystems = [];
foreach(string remoteOsName in ctx.RemoteOperatingSystems.Where(c => !c.Synchronized)
.Select(c => c.Name)

Some files were not shown because too many files have changed in this diff Show More