vdobler/chart

Incorrect bitshifts

Closed this issue · 2 comments

github.com/vdobler/chart/svgg/svg.go:59: suspicious shift of sg.bg.R
github.com/vdobler/chart/svgg/svg.go:59: suspicious shift of sg.bg.G
github.com/vdobler/chart/svgg/svg.go:59: suspicious shift of sg.bg.B
github.com/vdobler/chart/svgg/svg.go:60: suspicious shift of sg.bg.A
github.com/vdobler/chart/svgg/svg.go:73: suspicious shift of sg.bg.R
github.com/vdobler/chart/svgg/svg.go:73: suspicious shift of sg.bg.G
github.com/vdobler/chart/svgg/svg.go:73: suspicious shift of sg.bg.B
github.com/vdobler/chart/svgg/svg.go:73: suspicious shift of sg.bg.A

The above locations shift color.RGBA fields right by 8 (c.R >> 8). But as they are uint8s, a right shift of 8 will always yield 0. It's not obvious what these shifts are supposed to be doing.

You are right. Maybe these shifts are a relict from Color's interface RGBA method which produces uint16s.

fixed by e4082bd