C++ allows type-based aliasing and most compilers take advantage of this.
So if you have something like a struct containing your state variables, then this cannot possibly alias with a buffer of samples.
C++ allows type-based aliasing and most compilers take advantage of this.
If you write through float*, it will invalidate floats within the struct for sure. Compiler may do an aliasing check though, but it has to generate fail safe code if they do alias.
Actually, if you index (or do something equivalent) through the float* then there is no need to invalidate any scalar floats anywhere, because clearly you are either doing invalid pointer arithmetics or the objects can't alias, because indexing implies an array of some sort, hence the types are unrelated.
Zero index access can alias.mystran wrote: ↑Fri Dec 06, 2019 1:43 pm Actually, if you index (or do something equivalent) through the float* then there is no need to invalidate any scalar floats anywhere, because clearly you are either doing invalid pointer arithmetics or the objects can't alias, because indexing implies an array of some sort, hence the types are unrelated.
Right, but if you peel the first iteration or check for the loop counter (which you might do for unrolling anyway), then the fast-path can still rely on the pointers not aliasing.2DaT wrote: ↑Fri Dec 06, 2019 10:09 pmZero index access can alias.mystran wrote: ↑Fri Dec 06, 2019 1:43 pm Actually, if you index (or do something equivalent) through the float* then there is no need to invalidate any scalar floats anywhere, because clearly you are either doing invalid pointer arithmetics or the objects can't alias, because indexing implies an array of some sort, hence the types are unrelated.
© KVR Audio, Inc. 2000-2024
Submit: News, Plugins, Hosts & Apps | Advertise @ KVR | Developer Account | About KVR / Contact Us | Privacy Statement