Il 22/08/2013 04:02, Alexey Kardashevskiy ha scritto: >> Int128 is opaque, please use int128_and. To build the constant you have >> three choices (from my preferred to IMHO worst): >> >> - add a new int128_exts64 function that sign-extends an int64_t > > Like this? I am really scared to screw here :) > > static inline Int128 int128_exts64(int64_t a) > { > return (Int128) { .lo = a, .hi = (a < 0) ? -1 : 0 }; > }
Yes, or just a >> 63. >> - use int128_neg(int128_make64(TARGET_PAGE_SIZE)) or something like that > > Did you actually mean TARGET_PAGE_SIZE-1 (with -1)? I'll better use this > for now. it would be either ~(TARGET_PAGE_SIZE-1) or -TARGET_PAGE_SIZE, I think. >> - add a new int128_make function that takes a low/high pair and use >> int128_make(TARGET_PAGE_MASK, -1) > > I liked this one actually but you called it "worst" :) It is really the same as #1 but inlined, which is why I called it the worst. #2 is ugly for a different reason, namely because it changes the code more substantially, from using TARGET_PAGE_MASK pre-patch to TARGET_PAGE_SIZE post-patch. Paolo