Jan, you and I have the same understanding i.e. float <-> int is obviously 
non-free, but I can't think of why int <-> uint will not be free. However, 
I want someone with knowledge of the compiler/runtime/codegeneration/SSA 
internals that can give me a definitive answer. 

On Saturday, November 24, 2018 at 10:25:58 AM UTC-5, Jan Mercl wrote:
>
> On Sat, Nov 24, 2018 at 4:02 PM Ugorji Nwoke <ugo...@gmail.com 
> <javascript:>> wrote:
>
> > I understand the rules from the context of the language and what the 
> compiler will accept - conversion MUST be explicit. I am asking if there is 
> any runtime cost to the conversion between int and uint,
> > given that they "should" have the same representation, or if it is free. 
> I can see how there is a cost for float64 <-> float32, or for float64 <-> 
> int, but is there a cost for the specific case of int <-> uint?
>
> 'floatxx' <-> 'floatyy' <-> 'intzz' is obviously non free.
>
> But what possible run-time cost in conversion between 'uint' and 'int' - 
> considering it's always valid and the bit representations have the same 
> shape, size, organization and modulo the sign bit also interpretation - can 
> you think of?
>
>
>
> -- 
>
> -j
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to