On Sat, Feb 5, 2022 at 7:38 PM Marcelo Cantos <marcelo.can...@gmail.com> wrote:
> Explicit casting is no better, and there is no promotion (e.g., cast i to > int and cast the result back to T) that's suitable for all integer types. > FWIW `uint64` and `int64` are large enough to represent any un/signed integer types respectively. Depending on the case, as long as you can assume that your values fall in an appropriate range, you can use one of them. I would like to shrink the block size for (u)int8, but there's no way to > specialize the logic for specific types. > > I figured out that I can use *i >> 9* instead of *i / 512* in this > instance, though there will be other cases (divide by non-Po2) where there > isn't a simple workaround Is there a general way around this limitation? > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/6a844487-0c22-443f-8e6e-c38860929515n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/6a844487-0c22-443f-8e6e-c38860929515n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEkBMfGbLYnivnwO-_d_Z%2B-PuhWZYaMUEqP-JH8Xh74_E_uFoA%40mail.gmail.com.