in reply to Re^8: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
in thread Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
I based this on the results of the Test::More tests that said it was all producing the same output. Apparently, either it's working by some fluke, or the tests are broken.
Something is definitely wrong with the testing. The error shows up when and only when I comment out cmpthese.
Even if I change do_rand to the following to make sure there is always NUL in the returned string:
sub do_rand { my $min = shift; my $len = shift; { my $n = ""; for (1 .. $len) { $n .= chr( rand(255-$min)+$min ); } if ($min == 0 && $n !~ /\x00/) { print("REDO!\n"); redo; } return $n; } }
Updated.
|
|---|