| ▲ | secondcoming 6 hours ago | |||||||||||||||||||||||||||||||
If you enforce that the buffer size is a power of 2 you just use a mask to do the
part | ||||||||||||||||||||||||||||||||
| ▲ | JonChesterfield 6 hours ago | parent | next [-] | |||||||||||||||||||||||||||||||
If it's a power of two, you don't need the branch at all. Let the unsigned index wrap. | ||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
| ▲ | dalvrosa 6 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||
Indeed that's true. That extra constraint enables further optimization It's mentioned in the post, but worth reiterating! | ||||||||||||||||||||||||||||||||
| ▲ | loeg 6 hours ago | parent | prev [-] | |||||||||||||||||||||||||||||||
This was, in fact, mentioned in the article. | ||||||||||||||||||||||||||||||||