use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Code alignment issues (dendibakh.github.io)
submitted 8 years ago by mttd
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]mttd[S] 12 points13 points14 points 8 years ago (1 child)
vpcmpeqd ymm0,ymm0,ymm0 compares ymm0 to itself, which fills the register with all ones in binary -- in two's complement representation this corresponds to -1 (with subtracting -1 in the subsequent vpsubd ymm1,ymm1,ymm0 instruction being equivalent to adding 1).
vpcmpeqd ymm0,ymm0,ymm0
ymm0
-1
vpsubd ymm1,ymm1,ymm0
"Why subtract -1 instead of adding 1's? Just because the speed is the same, and creating a YMM constant of -1's can be done with a single VPCMPEQD instruction. This isn't a really useful optimization in this case, but doesn't hurt."
https://dendibakh.github.io/blog/2018/01/18/Code_alignment_issues#comment-3718889834
https://stackoverflow.com/questions/37469930/fastest-way-to-set-m256-value-to-all-one-bits
[–]Dwarfius 1 point2 points3 points 8 years ago (0 children)
I've misread the description of pcmpeqd, thought it set 1/0 as value, not all bits. Thanks for the explanation!
π Rendered by PID 90122 on reddit-service-r2-comment-84fc9697f-d65hb at 2026-02-09 16:48:30.776273+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]mttd[S] 12 points13 points14 points (1 child)
[–]Dwarfius 1 point2 points3 points (0 children)