[go-nuts] Re: Quirk with width of format string like %#05x

2019-01-03 Thread moehrmann via golang-nuts
To keep backwards compatibility with go1 changing fmt to count in the 0x 
for the padding was discussed and abandoned in 
https://go-review.googlesource.com/c/go/+/22136/.

-- 
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.


[go-nuts] Re: built tests fail on sierra 10.12.6

2017-08-17 Thread moehrmann via golang-nuts
I filed an issue a few days ago since i had the same problem:
https://github.com/golang/go/issues/21416

-- 
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.


[go-nuts] Re: expected bahaviour for fmt.Stringer within a container in a struct?

2017-08-31 Thread moehrmann via golang-nuts
m is an unexported Field. fmt can not use interface() on the reflect values 
to then call String on them on anything unexported or below. 

This also happens if m is just interface{} and not a map:
https://play.golang.org/p/ODrjW3Fslf

If m is made an exported field by naming it M it works:
https://play.golang.org/p/Q1O31-XMBP

On Thursday, August 31, 2017 at 8:28:13 AM UTC+2, kortschak wrote:
>
> What is the expected behaviour for this code? 
>
> https://play.golang.org/p/tp9YNQZRMo 
>
> ``` 
> package main 
>
> import ( 
> "fmt" 
> ) 
>
> type char int 
>
> func (c char) String() string { return string(c) } 
>
> type st struct { 
> m map[int]interface{} 
> } 
>
> func main() { 
> a := char('A') 
> s := st{map[int]interface{}{1: a}} 
> fmt.Printf("%v %v", s, s.m) 
> } 
> ``` 
>
> I would expect both cases to print the `a` values as an 'A'. 
>

-- 
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.


[go-nuts] Re: instruction gen in amd64, it iseems not the best choice?

2020-08-26 Thread moehrmann via golang-nuts
As far as I am aware:

A LEA with a scale of 3 does not exist on amd64. Scale can be 1,2,4,8.

A LEA with 3 arguments LEAQ 4(AX)(AX*2) on many modern amd64 compatible 
machines will use 3 cycles instead of 2 for two simpler LEA.
The newest generation of Intel CPUs seems to have gotten better again 
avoiding slow LEA.

https://github.com/golang/go/issues/21735
https://github.com/golang/go/issues/31900

On Wednesday, August 26, 2020 at 5:04:15 AM UTC+2, xie cui wrote:
>
> function:
> func test3(a int) int {
>   return a * 3 + 4
> }
>
> go version go1.13.5 darwin/amd64
> generate instructions:
>   LEAQ(AX)(AX*2), AX
>   LEAQ4(AX), AX
>
> As far as i known,there a better choice
>  LEAQ4(AX*3), AX
>
> Can it be optimized?
>
>

-- 
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/0d638194-eaf0-4b99-b66e-c831d8491470o%40googlegroups.com.