Conversation
ba6d557 to
25a1cf8
Compare
|
@serge-sans-paille this one is ready too |
| } | ||
|
|
||
| template <status status_id, typename L> | ||
| inline auto const& safe_get_leaf(L& leaf) const |
There was a problem hiding this comment.
I'm puzzled by the fact that this functions takes a non-const ref but returns a const-ref on the same storage. leaf has an integral type, so maybe pass everything by value?
There was a problem hiding this comment.
And rename leaf has default_value or something
There was a problem hiding this comment.
I'm puzzled by the fact that this functions takes a non-const ref but returns a const-ref on the same storage.
Well that where the caching happens. This function is a utility to factor code internally.
The input must be a non-cons reference. It is passed the class member, that may or may not be initialized and returns something that should not modify the object itself.
It need to be given the class member leaf because the point it to factor the code between different leaves, so we need to know which one and its type.
leaf has an integral type, so maybe pass everything by value?
Leaf is 4 32 bit integers. Not sure if better to return by value or const ref, but probably does not make a difference after the compiler has done its pass.
And rename
leafhasdefault_valueor something
It's not really the default value though, it's the "storage" that we write to if it was uninitialized (in the C++ sens everything is initialized, just not with the value we care about).
Not implemented previously in xsimd, CPUID requires to first check which leaves are available before calling it, otherwise the value returned may be invalid.
leaf < 0x80000000, check leaf 0 EAXleaf > 0x80000000, check leaf 0x80000000 EAX