immutablejs源碼中這個計算數(shù)字哈希的函數(shù)的怎么理解?function hashNum(o) {var type = typeof o; if (type === 'number') { if (o !== o || o === Infinity) { return 0; } var h = o | 0; if (h !== o) { h ^= o * 0xFFFFFFFF; } while (o > 0xFFFFFFFF) { o /= 0xFFFFFFFF; h ^= o; } return smi(h); }}// v8 has an optimization(優(yōu)化組合) for storing 31-bit signed numbers(有正負符號數(shù)).// Values which have either 00 or 11 as the high order bits(高字節(jié)位) qualify(限定).// This function drops the highest order bit in a signed number(有正負符號數(shù)), maintaining(堅持,保衛(wèi))// the sign bit(符號位).function smi(i32) { return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF);}
immutablejs源碼中這個計算數(shù)字哈希的函數(shù)的怎么理解?
德瑪西亞99
2018-11-14 14:14:38