Re: [go-nuts] Change slice type

2019-11-27 Thread Jan Mercl
On Thu, Nov 28, 2019 at 3:16 AM Michael Jones wrote: > > The general rule -- if there can be a general rule for risk behavior -- is > that CPUs like having addresses aligned on an integer multiple of the data > element size. So: > > access-as-byte data may be on any address (address&(1-1)==0),

Re: [go-nuts] Change slice type

2019-11-27 Thread Michael Jones
The general rule -- if there can be a general rule for risk behavior -- is that CPUs like having addresses aligned on an integer multiple of the data element size. So: access-as-byte data may be on any address (address&(1-1)==0), access as 2-byte data on a multiple of two address

Re: [go-nuts] Change slice type

2019-11-27 Thread Ian Lance Taylor
On Wed, Nov 27, 2019 at 9:26 AM wrote: > > Hi Ian, thanks for the help... quick question about alignment because i may > be doing something wrong but it shows me that it doesn't matter for the slice > type, everything is alignment the same way. Can you comment on this? All slices have the same

Re: [go-nuts] Change slice type

2019-11-27 Thread gregto83
Hi Ian, thanks for the help... quick question about alignment because i may be doing something wrong but it shows me that it doesn't matter for the slice type, everything is alignment the same way. Can you comment on this? On 32 bit it'll always return 4 and for 64 bit - 8... even for char or

Re: [go-nuts] Change slice type

2019-11-26 Thread Ian Lance Taylor
On Tue, Nov 26, 2019 at 5:47 AM wrote: > > When i have a buffer > x:=make([]byte, 0, 8) > > Is it possible to use same memory range as []int of size: > FLOOR(8*size_of(byte)/size_of(int)). Basically i want to make slab > allocator better It is possible to do this using the unsafe

[go-nuts] Change slice type

2019-11-26 Thread gregto83
Hi Guys, quick question... When i have a buffer x:=make([]byte, 0, 8) Is it possible to use same memory range as []int of size: FLOOR(8*size_of(byte)/size_of(int)). Basically i want to make slab allocator better Thanks -- You received this message because you are subscribed to the