Skip to content

Commit

Permalink
Fixed an incorrect 64-bit shift
Browse files Browse the repository at this point in the history
Some pairs were skipped because of that
  • Loading branch information
SChernykh committed Apr 9, 2024
1 parent 5cef711 commit b74d428
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Amicable/kernel.cl
Expand Up @@ -1556,8 +1556,10 @@ void SearchLargePrimes(

const uint shift = (amicableCandidateByteIndex & 7) * 8;

data0 = (data0 >> shift) | (data1 << (64u - shift));
data1 >>= shift;
if (shift > 0) {
data0 = (data0 >> shift) | (data1 << (64u - shift));
data1 >>= shift;
}

ulong value_ulong = (data0 & 4294967295u) | ((data1 & 15u) << 32u);
ulong sum_ulong = (data0 >> 32u) | ((data1 & 240u) << 28u);
Expand Down
1 change: 1 addition & 0 deletions Amicable/self_test.inl
Expand Up @@ -284,6 +284,7 @@ static const char* pair_list[][2] = {
{"209571526720765418248","449081841217278931200"},
{"212288438448899830017","426492492429459456000"},
{"216149902781324943585","432928271999537233920"},
{"219086436373309852328","443833140491867952000"},
{"220060507708442748555","445084104124012953600"},
{"222541403130141804982","464228829994619289600"},
{"224730968185662031624","462360501729828748800"},
Expand Down

0 comments on commit b74d428

Please sign in to comment.