예제 #1
0
        public unsafe static int[] Funs(byte[] arr)
        {
            FFFP[] func = new FFFP[16];
            func[0]  = FP_000;
            func[1]  = FP_001;
            func[2]  = FP_002;
            func[3]  = FP_003;
            func[4]  = FP_004;
            func[5]  = FP_005;
            func[6]  = FP_006;
            func[7]  = FP_007;
            func[8]  = FP_008;
            func[9]  = FP_009;
            func[10] = FP_010;
            func[11] = FP_011;
            func[12] = FP_012;
            func[13] = FP_013;
            func[14] = FP_014;
            func[15] = FP_015;

            int[] rs  = new int[256];
            int * rss = stackalloc int[rs.Length];

            fixed(byte *pd = &arr[0])
            {
                byte *    ap0        = pd;
                const int bsize      = 8;
                int       length     = arr.Length;
                int       blockCount = length / bsize;
                int       i          = 0;

                for (; i < blockCount * bsize; i += bsize)
                {
                    //func[*(ap0 + 0)](rss);
                    //func[*(ap0 + 1)](rss);
                    //func[*(ap0 + 2)](rss);
                    //func[*(ap0 + 3)](rss);
                    //func[*(ap0 + 4)](rss);
                    //func[*(ap0 + 5)](rss);
                    //func[*(ap0 + 6)](rss);
                    //func[*(ap0 + 7)](rss);
                    func[*(ap0 + 0) & 0x0F](rss);
                    func[*(ap0 + 1) & 0x0F](rss);
                    func[*(ap0 + 2) & 0x0F](rss);
                    func[*(ap0 + 3) & 0x0F](rss);
                    func[*(ap0 + 4) & 0x0F](rss);
                    func[*(ap0 + 5) & 0x0F](rss);
                    func[*(ap0 + 6) & 0x0F](rss);
                    func[*(ap0 + 7) & 0x0F](rss);
                    ap0 += 8;
                }
            }

            for (int i = 0; i < rs.Length; i++)
            {
                rs[i] += rss[i];
            }
            return(rs);
        }
예제 #2
0
        public unsafe static int[] Funs(byte[] arr)
        {
            FFFP[] func = new FFFP[256];
            func[0]   = FP_000;
            func[1]   = FP_001;
            func[2]   = FP_002;
            func[3]   = FP_003;
            func[4]   = FP_004;
            func[5]   = FP_005;
            func[6]   = FP_006;
            func[7]   = FP_007;
            func[8]   = FP_008;
            func[9]   = FP_009;
            func[10]  = FP_010;
            func[11]  = FP_011;
            func[12]  = FP_012;
            func[13]  = FP_013;
            func[14]  = FP_014;
            func[15]  = FP_015;
            func[16]  = FP_016;
            func[17]  = FP_017;
            func[18]  = FP_018;
            func[19]  = FP_019;
            func[20]  = FP_020;
            func[21]  = FP_021;
            func[22]  = FP_022;
            func[23]  = FP_023;
            func[24]  = FP_024;
            func[25]  = FP_025;
            func[26]  = FP_026;
            func[27]  = FP_027;
            func[28]  = FP_028;
            func[29]  = FP_029;
            func[30]  = FP_030;
            func[31]  = FP_031;
            func[32]  = FP_032;
            func[33]  = FP_033;
            func[34]  = FP_034;
            func[35]  = FP_035;
            func[36]  = FP_036;
            func[37]  = FP_037;
            func[38]  = FP_038;
            func[39]  = FP_039;
            func[40]  = FP_040;
            func[41]  = FP_041;
            func[42]  = FP_042;
            func[43]  = FP_043;
            func[44]  = FP_044;
            func[45]  = FP_045;
            func[46]  = FP_046;
            func[47]  = FP_047;
            func[48]  = FP_048;
            func[49]  = FP_049;
            func[50]  = FP_050;
            func[51]  = FP_051;
            func[52]  = FP_052;
            func[53]  = FP_053;
            func[54]  = FP_054;
            func[55]  = FP_055;
            func[56]  = FP_056;
            func[57]  = FP_057;
            func[58]  = FP_058;
            func[59]  = FP_059;
            func[60]  = FP_060;
            func[61]  = FP_061;
            func[62]  = FP_062;
            func[63]  = FP_063;
            func[64]  = FP_064;
            func[65]  = FP_065;
            func[66]  = FP_066;
            func[67]  = FP_067;
            func[68]  = FP_068;
            func[69]  = FP_069;
            func[70]  = FP_070;
            func[71]  = FP_071;
            func[72]  = FP_072;
            func[73]  = FP_073;
            func[74]  = FP_074;
            func[75]  = FP_075;
            func[76]  = FP_076;
            func[77]  = FP_077;
            func[78]  = FP_078;
            func[79]  = FP_079;
            func[80]  = FP_080;
            func[81]  = FP_081;
            func[82]  = FP_082;
            func[83]  = FP_083;
            func[84]  = FP_084;
            func[85]  = FP_085;
            func[86]  = FP_086;
            func[87]  = FP_087;
            func[88]  = FP_088;
            func[89]  = FP_089;
            func[90]  = FP_090;
            func[91]  = FP_091;
            func[92]  = FP_092;
            func[93]  = FP_093;
            func[94]  = FP_094;
            func[95]  = FP_095;
            func[96]  = FP_096;
            func[97]  = FP_097;
            func[98]  = FP_098;
            func[99]  = FP_099;
            func[100] = FP_100;
            func[101] = FP_101;
            func[102] = FP_102;
            func[103] = FP_103;
            func[104] = FP_104;
            func[105] = FP_105;
            func[106] = FP_106;
            func[107] = FP_107;
            func[108] = FP_108;
            func[109] = FP_109;
            func[110] = FP_110;
            func[111] = FP_111;
            func[112] = FP_112;
            func[113] = FP_113;
            func[114] = FP_114;
            func[115] = FP_115;
            func[116] = FP_116;
            func[117] = FP_117;
            func[118] = FP_118;
            func[119] = FP_119;
            func[120] = FP_120;
            func[121] = FP_121;
            func[122] = FP_122;
            func[123] = FP_123;
            func[124] = FP_124;
            func[125] = FP_125;
            func[126] = FP_126;
            func[127] = FP_127;
            func[128] = FP_128;
            func[129] = FP_129;
            func[130] = FP_130;
            func[131] = FP_131;
            func[132] = FP_132;
            func[133] = FP_133;
            func[134] = FP_134;
            func[135] = FP_135;
            func[136] = FP_136;
            func[137] = FP_137;
            func[138] = FP_138;
            func[139] = FP_139;
            func[140] = FP_140;
            func[141] = FP_141;
            func[142] = FP_142;
            func[143] = FP_143;
            func[144] = FP_144;
            func[145] = FP_145;
            func[146] = FP_146;
            func[147] = FP_147;
            func[148] = FP_148;
            func[149] = FP_149;
            func[150] = FP_150;
            func[151] = FP_151;
            func[152] = FP_152;
            func[153] = FP_153;
            func[154] = FP_154;
            func[155] = FP_155;
            func[156] = FP_156;
            func[157] = FP_157;
            func[158] = FP_158;
            func[159] = FP_159;
            func[160] = FP_160;
            func[161] = FP_161;
            func[162] = FP_162;
            func[163] = FP_163;
            func[164] = FP_164;
            func[165] = FP_165;
            func[166] = FP_166;
            func[167] = FP_167;
            func[168] = FP_168;
            func[169] = FP_169;
            func[170] = FP_170;
            func[171] = FP_171;
            func[172] = FP_172;
            func[173] = FP_173;
            func[174] = FP_174;
            func[175] = FP_175;
            func[176] = FP_176;
            func[177] = FP_177;
            func[178] = FP_178;
            func[179] = FP_179;
            func[180] = FP_180;
            func[181] = FP_181;
            func[182] = FP_182;
            func[183] = FP_183;
            func[184] = FP_184;
            func[185] = FP_185;
            func[186] = FP_186;
            func[187] = FP_187;
            func[188] = FP_188;
            func[189] = FP_189;
            func[190] = FP_190;
            func[191] = FP_191;
            func[192] = FP_192;
            func[193] = FP_193;
            func[194] = FP_194;
            func[195] = FP_195;
            func[196] = FP_196;
            func[197] = FP_197;
            func[198] = FP_198;
            func[199] = FP_199;
            func[200] = FP_200;
            func[201] = FP_201;
            func[202] = FP_202;
            func[203] = FP_203;
            func[204] = FP_204;
            func[205] = FP_205;
            func[206] = FP_206;
            func[207] = FP_207;
            func[208] = FP_208;
            func[209] = FP_209;
            func[210] = FP_210;
            func[211] = FP_211;
            func[212] = FP_212;
            func[213] = FP_213;
            func[214] = FP_214;
            func[215] = FP_215;
            func[216] = FP_216;
            func[217] = FP_217;
            func[218] = FP_218;
            func[219] = FP_219;
            func[220] = FP_220;
            func[221] = FP_221;
            func[222] = FP_222;
            func[223] = FP_223;
            func[224] = FP_224;
            func[225] = FP_225;
            func[226] = FP_226;
            func[227] = FP_227;
            func[228] = FP_228;
            func[229] = FP_229;
            func[230] = FP_230;
            func[231] = FP_231;
            func[232] = FP_232;
            func[233] = FP_233;
            func[234] = FP_234;
            func[235] = FP_235;
            func[236] = FP_236;
            func[237] = FP_237;
            func[238] = FP_238;
            func[239] = FP_239;
            func[240] = FP_240;
            func[241] = FP_241;
            func[242] = FP_242;
            func[243] = FP_243;
            func[244] = FP_244;
            func[245] = FP_245;
            func[246] = FP_246;
            func[247] = FP_247;
            func[248] = FP_248;
            func[249] = FP_249;
            func[250] = FP_250;
            func[251] = FP_251;
            func[252] = FP_252;
            func[253] = FP_253;
            func[254] = FP_254;
            func[255] = FP_255;


            int[] rs  = new int[256];
            int * rss = stackalloc int[rs.Length];

            fixed(byte *pd = &arr[0])
            {
                byte *    ap0        = pd;
                const int bsize      = 8;
                int       length     = arr.Length;
                int       blockCount = length / bsize;
                int       i          = 0;

                for (; i < blockCount * bsize; i += bsize)
                {
                    func[*(ap0 + 0)](rss);
                    func[*(ap0 + 1)](rss);
                    func[*(ap0 + 2)](rss);
                    func[*(ap0 + 3)](rss);
                    func[*(ap0 + 4)](rss);
                    func[*(ap0 + 5)](rss);
                    func[*(ap0 + 6)](rss);
                    func[*(ap0 + 7)](rss);
                    ap0 += 8;
                }
            }

            for (int i = 0; i < rs.Length; i++)
            {
                rs[i] += rss[i];
            }
            return(rs);
        }