You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixing C arrays in the language and making them the vocabulary type they should always have been.
TODO: more motivation
TODO: mention that fixing std::array is also a noble goal, but not one that this proposal pursues,
that said it's also worth noting that fixes applied to C arrays might also apply to std::array
TODO: make it only about stack arrays, somewhat disregard dynamic ones
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Considering that make_heap runs in O(n) time, the function sort_heap dominates the complexity when sorting a
sequence from scratch, so it naturally deserves the most attention when trying to find optimizations. I did not manage
to find a better algorithm that did not use extra memory for the job, but I was nevertheless able to obtain a 8~50%
speedup by optimizing bit_floor with compiler intrinsics.
The bit_floor implementation shown previously runs in O(log k) time when computing the bit floor of a k-bit unsigned
integer. Using intrinsices it is possible to compute the bit floor in O(1) by computing the position of the highest set
bit and shifting a single bit to that position. The algorithm below shows how to compute the bit floor of an unsigned
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Integer range in the spirit of std::integer_sequence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tentative to get a better swap_ranges (but hits optimizer issues)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters