<i>Can assert() actually function this way? Can you use assert to tell the optimizer it can assume something is true?</i><p>Yes, but it would have the potentially surprising behavior that compiling your release version with -DNDEBUG might slow it down.   We ran into this a couple years ago: <a href="https:&#x2F;&#x2F;plus.google.com&#x2F;+DanielLemirePhD&#x2F;posts&#x2F;BTSams19Ero" rel="nofollow">https:&#x2F;&#x2F;plus.google.com&#x2F;+DanielLemirePhD&#x2F;posts&#x2F;BTSams19Ero</a><p>Recent compilers support some extensions that can do it better.  GCC and CLang use __builtin_assume_aligned(), and ICC uses __assume_aligned() (haven&#x27;t tested the synonym).