Browse Source

evolved prime set and slightly new code for improved collision and avalanch performance

master
Pete McNeil 3 years ago
parent
commit
d2d5b7504f
2 changed files with 35 additions and 35 deletions
  1. 4
    3
      mishmash.cpp
  2. 31
    32
      mishmash.hpp

+ 4
- 3
mishmash.cpp View File

@@ -16,9 +16,10 @@ uint64_t masher::engine(
const masher::PrimeSet& primes) noexcept {
for(size_t index = 0; index < length; index++) {
unsigned char byte = buffer[index];
accumulator += primes.select(accumulator) + byte;
accumulator *= primes.select(byte);
accumulator += accumulator >> 32;
uint64_t accumulator1 = primes.select(accumulator) + byte;
uint64_t accumulator2 = ~accumulator * primes.select(byte);
uint64_t accumulator3 = accumulator >> (32 + ((byte & 0x1F) ^ (byte >> 5)));
accumulator = accumulator1 + accumulator2 + accumulator3;
}
return accumulator;
}

+ 31
- 32
mishmash.hpp View File

@@ -21,38 +21,37 @@ namespace masher {


const PrimeSet Primes {
2781111551, 4115761697, 2188512439, 3902941499, 4078728127, 2919449173, 3950407729, 4081733563,
4061783399, 2728829231, 3557004557, 3778858159, 2397085727, 3808921189, 3159484147, 4084759639,
2938297727, 3839623429, 2441361773, 2471079053, 4270995293, 3336967261, 2717746523, 3306593077,
2846319523, 2704420699, 2772002447, 2664263209, 3452941517, 3422898851, 2502691043, 3785866613,
3164194337, 3348481009, 3448873073, 2340666883, 3742418039, 2298597811, 3061650257, 4286896921,
2816281231, 3814879819, 3245870963, 2718113173, 3051925081, 2527351147, 2737897993, 3567396421,
3422709179, 3542178331, 3740214493, 3720784621, 2821606727, 3764267237, 3923068349, 3880303043,
3816527917, 3032326837, 4006470463, 4165427173, 2511539731, 2993685649, 2268550831, 2899250059,
2432655553, 3959959639, 4142838449, 4100124029, 2962655827, 2648245423, 4117297801, 3331059481,
2287716593, 4115533181, 2411037073, 3273978871, 2395052183, 2776949353, 3871801559, 2948305931,
2257427881, 4288176181, 2624064151, 3144150523, 4282472071, 2206613407, 2960685401, 2761304627,
3187632967, 2447380627, 2781789473, 3657272401, 3603710699, 4042745507, 4087095841, 2354409557,
2239000559, 4164370321, 3636939347, 3622573529, 2202257819, 2792364713, 2803311809, 4006899277,
2835975767, 2951997809, 3185753917, 2417651723, 2631379747, 2175388331, 4277708983, 3547799261,
3093003779, 3653208029, 4084095199, 3161669417, 2698224923, 2746404013, 3209829191, 3024118079,
3799471327, 3012753409, 2653321639, 2777700139, 3794895031, 3075822329, 2774150557, 3135465059,
2294247001, 3557999149, 3189799397, 4080431539, 3397276529, 3931450153, 3518901437, 3135266501,
3275906693, 4143264221, 3439131923, 2462856037, 2441331799, 2640219781, 3504419027, 3721296989,
3434920081, 2852097271, 3199425679, 3785517557, 2984788193, 3678788947, 2308371491, 3354456173,
4148931503, 3239885063, 3894052103, 3930187787, 3521437319, 3203332001, 2894779337, 4197047957,
3080099353, 2304447583, 3731998477, 2733978179, 2235339121, 2490436339, 2147689987, 3276115639,
3923204273, 3402325321, 3082785493, 3420863399, 3203562407, 2292225781, 3461192447, 2589852949,
2772559931, 3667144931, 2163126419, 3412216831, 3699715037, 3619099453, 3875532569, 3047225267,
3780456941, 2512094297, 3527794547, 3130190737, 3013107347, 3691645577, 3877430399, 4270767517,
2797247227, 3976455169, 3541991143, 3737016677, 3801675821, 2233908737, 3210598117, 4200595549,
2772203789, 2415614503, 2467043143, 2611954561, 2791210277, 2599276769, 4034287091, 3521719193,
3060219497, 2799601709, 2178939557, 3800717749, 3426533269, 3519387097, 2861815447, 2884852603,
2814915449, 3359572921, 3013763303, 3565679363, 3491538893, 2588490083, 3441048649, 2501343701,
4191701149, 2251607773, 3543948791, 3511969763, 2966565907, 3640359409, 3640516129, 2586869203,
2328651011, 4037640461, 3601356797, 4260950119, 3198526459, 3478546597, 3009442531, 3594323353,
3205141207, 3592422991, 3357971081, 3217249313, 2903534827, 3716714951, 3388800011, 3045269987,
2325616213, 2688355151, 3022034467, 4221197753, 2426944493, 3090262709, 3471570467, 2437347167
3238836313, 3360886099, 3993634273, 4064669561, 4208856901, 4049234129, 2251082663, 2536872017,
3172087459, 4219386191, 3254853737, 2374917353, 3448754471, 3118274443, 3572204863, 3686337631,
2961431969, 3025133497, 2856326813, 4277854241, 2469276751, 3175023217, 4065345943, 2191667573,
3716607571, 3186473551, 2993231543, 2854210481, 3661300009, 4160057677, 3393580357, 2401731751,
3089619301, 3049406923, 2689305253, 2226455687, 2384594237, 2321314543, 3358155473, 2769745513,
4064412181, 3546679369, 2971824769, 3312622147, 3878690237, 4226789561, 3945135893, 2667481697,
3886727213, 2447929819, 2905769257, 2655507487, 2151468307, 2774610127, 3117477541, 2619506011,
2224830217, 4005223571, 2817826603, 4024485649, 2357623691, 3380603881, 3799676627, 3174723401,
2925703279, 3692030071, 3928564727, 3822903739, 2520472573, 2345602981, 2318506963, 2933432651,
2964809711, 3441413681, 3537168083, 3213751901, 3785291413, 3874794739, 2703288127, 4139044993,
2757352427, 3533741287, 2767266521, 3616593653, 4121176723, 2759804627, 2613878749, 3621322741,
3365797381, 3780923077, 4090912909, 2400326909, 3222524423, 2824243943, 2496802109, 2268391639,
3124087573, 3716479807, 3131673143, 2598657163, 3239086001, 3049736639, 2288116447, 3310352849,
3095504927, 3299510729, 4177820137, 3414229717, 3243438811, 3532678967, 3232117841, 3951863177,
2555079403, 3921722923, 2767778263, 3642539597, 2259834439, 3378013361, 3318867061, 2219022677,
4283411207, 3528301687, 2626036943, 2258523251, 3833937103, 3639081947, 4029829451, 2360238479,
2184594703, 4187931989, 2562197887, 3622455827, 3374449921, 3194095649, 4048368617, 2355855647,
4187863969, 3671153483, 2548899877, 3752659289, 3019207333, 3000748913, 2969725901, 2288226749,
3941344529, 2160836201, 2557613741, 2747755807, 2813873353, 2437638083, 2278088377, 2925209927,
4245758497, 3470038853, 2625083243, 2293827821, 3819793067, 3887526641, 3810382399, 4129510223,
3184769573, 3942422921, 3000411851, 2267160979, 3295636387, 3962735783, 2857209623, 2388617971,
3691266013, 2683345051, 3245511107, 3349852217, 2544095017, 3631826647, 4105881239, 2762987873,
2666463031, 2946438881, 3113899517, 2223454549, 2568559537, 3101729287, 2555320727, 3030152533,
2979132743, 4253672737, 2870043779, 2843306603, 3926687683, 4185601351, 3731200831, 3722500409,
4115072947, 2615487569, 2389531631, 3868949611, 2337008593, 2515079899, 2521605199, 3168567119,
3580694591, 3845527589, 3722753051, 2668632049, 3667111729, 3874685057, 3226838213, 2720181421,
2612026369, 2694744433, 4155238081, 3521473309, 3862885931, 3115061903, 4166213797, 3520042793,
3944208013, 4078403383, 2285388311, 3719800027, 4016404867, 3390427661, 3338388139, 2660266009,
3032933947, 4200211513, 3155686909, 3019786009, 4125535433, 3244923947, 2398660417, 2758948859,
2944556507, 3818410403, 2247818519, 2586876613, 3420280733, 4236637451, 2724168703, 3321056041,
2625015193, 2795623993, 3911522341, 3507684083, 3553065317, 3987511039, 2786582429, 2534596151
};
uint64_t engine(

Loading…
Cancel
Save