Fixes issue 99. Replace aligned loads with unaligned.#101
Conversation
|
@pps83 Would you review? |
| std::numeric_limits<int32_t>::min(), | ||
| std::numeric_limits<int32_t>::max()); | ||
| for (int i = 0; i < values; ++i) { | ||
| for (uint32_t i = 0; i < values; ++i) { |
There was a problem hiding this comment.
unsigned. Even though values is uint32_t, it's quite strange to use uint32_t as loop counter.
same for a change bellow
There was a problem hiding this comment.
Seems necessary to ensure i < values is both efficient and correct for values approaching std::numeric_limits<uint32_t>::max() right?
There was a problem hiding this comment.
Maybe to avoid any concern, you could use the standard algorithms library to fill the vector in a declarative fashion.
| for (uint32_t i = 0; i < values; ++i) { | |
| std::generate_n(std::begin(v), values, std::bind(dist, e2)); |
There was a problem hiding this comment.
that would be outside of the scope of the PR.
There was a problem hiding this comment.
it's quite strange to use uint32_t as loop counter.
Why? Many compilers object to signed/unsigned comparisons. I don't want to change the type of values. The alternative for the counters are size_t, unsigned int, ... none of them functionally better. Well, size_t (an unsigned type) is arguably better but I am not certain it matters.
std::generate_n(std::begin(v), values, std::bind(dist, e2));
@cbsmith Good idea, but it is out of scope here. I only changed that bit to silence a warning. If you'd like to modernize the C++, the please consider issue a distinct PR. There is much that could be done...
|
also, it looks it's based off from some old version, not from the last master. |
50ba7f1 to
7e4710c
Compare
|
I checked the PR, many of the issues I saw got resolved. However, I still see one place where a byte or two end up unmodified the output. Perhaps, it's ok to merge this one, and take a look at that issue separately. |
|
Merging. @cbsmith : I invite you to prepare a distinct PR if you'd like. |
Based on #100 but arguably more complete and better?
Credit to @pps83 for the hard work.
Fixes #99