Stream: t-libs/stdarch

Topic: (no topic)


Luca Barbato (Oct 16 2019 at 21:21, on Zulip):

this is my first try https://github.com/xiph/rav1e/pull/1768/commits/3cd84ecc2bb1dd905bb54f2dd69bb3506be70b17

Luca Barbato (Oct 17 2019 at 08:27, on Zulip):

and apparently the main problem was me misreading what the assembly using it was expecting

gnzlbg (Oct 17 2019 at 08:44, on Zulip):

I mean, if you just want a static array that's aligned, you can do:

#[repr(align(N)] struct MyArray([T; N]);
static FOO: MyArray = MyArray([ ... ]);
gnzlbg (Oct 17 2019 at 08:46, on Zulip):

You can set the N in repr(align(N)) to whatever alignment you want, and the alignment of the array will be max(N, align_of<T>)

Luca Barbato (Oct 18 2019 at 07:52, on Zulip):

yes, I can simplify the notation

gnzlbg (Oct 18 2019 at 08:05, on Zulip):

So that's the best way we have for that

gnzlbg (Oct 18 2019 at 08:07, on Zulip):

In C++ things are a bit better because we can use const generics and metaprogramming to set the type alignment, but otherwise things are similar

gnzlbg (Oct 18 2019 at 08:08, on Zulip):
template<typename T, size_t N>
struct simd_array {
    alignas(sizeof(T) * N) T data[N];
};
Luca Barbato (Oct 18 2019 at 08:08, on Zulip):

quite a bit

Luca Barbato (Oct 18 2019 at 08:09, on Zulip):

newtyping is fine IMHO

Last update: Nov 15 2019 at 09:40UTC