Divide 64-bit integers as though the dividend is shifted left 64 bits, without having 128-bit types
问题 Apologies for the confusing title. I'm not sure how to better describe what I'm trying to accomplish. I'm essentially trying to do the reverse of getting the high half of a 64-bit multiplication in C for platforms where int64_t divHi64(int64_t dividend, int64_t divisor) { return ((__int128)dividend << 64) / (__int128)divisor; } isn't possible due to lacking support for __int128 . 回答1: This can be done without a multi-word division Suppose we want to do ⌊2 64 × x ⁄ y ⌋ then we can transform