[ 
https://issues.apache.org/jira/browse/ARROW-2373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16421484#comment-16421484
 ] 

Andy Grove commented on ARROW-2373:
-----------------------------------

I just got this suggestion on the Rust forum:

 

"Just make a type that is a 64-byte aligned array of 16 i32s (or just 64 u8s, 
although if you are using it as i32s it’s more elegant to use i32s), make a Vec 
of that, and then a newtype over that Vec that implements Deref to &i32 by 
transmuting."

 

"Add an extra size field to the newtype if you need to keep track of size at 
primitive granularity."

 

This seems almost ideal to me.

 

> [Rust] Investigate alternate ways to achieve byte-aligned memory
> ----------------------------------------------------------------
>
>                 Key: ARROW-2373
>                 URL: https://issues.apache.org/jira/browse/ARROW-2373
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: Rust
>            Reporter: Andy Grove
>            Priority: Minor
>
> The current Rust implementation of Buffer<T> relies on libc and unsafe code 
> to allocate byte-aligned buffers.
> It would be nice to find a safer way to do this.
> Rust 1.25 added support for byte-aligned structs, but that doesn't help.
> I have started a discussion in the Rust develop forum about adding support 
> for byte-aligned Vec: 
> [https://internals.rust-lang.org/t/byte-aligned-vec/7200]
> Feedback so far is "We’re getting close to stabilizing some of the allocator 
> API which will let you make a custom type that does this though.".



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to