OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-CompactHash commits / f561308

Fixing compiler warning for ternary CMPXCHG operator
f561308114e14279a1c8ff467ecd2acc869f4465
by Bob Robey <brobey@lanl.gov> · 2015-10-24T22:58:31.000Z

Changed files (4) +130 -241

HashFactory/HashFactory.c +99 -162
……@@ -1,31 +1,4 @@
11
2/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18/* This header is separate from features.h so that the compiler can
19 include it implicitly at the start of every compilation. It must
20 not itself include <features.h> or any other header that includes
21 <features.h> because the implicit include comes before any feature
22 test macros that may be defined in a source file before it first
23 explicitly includes a system header. GCC knows the name of this
24 header in order to preinclude it. */
25/* We do support the IEC 559 math functionality, real and complex. */
26/* wchar_t uses ISO/IEC 10646 (2nd ed., published 2011-03-15) /
27 Unicode 6.0. */
28/* We do not support C11 <threads.h>. */
292/* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced
303 * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National
314 * Laboratory (LANL), which is operated by Los Alamos National Security, LLC
……@@ -63,6 +36,7 @@
6336 * @date Thu Jun 6 2013
6437 */
6538//
39
6640#include "HashFactory.h"
6741#ifdef HAVE_OPENCL
6842#ifdef __APPLE_CC__
……@@ -147,7 +121,9 @@ int clFinish(int command_queue) {
147121#endif
148122#define PRIME_NUM_CHECKS 20
149123typedef unsigned int uint;
124
150125#include <math.h>
126
151127/* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced
152128 * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National
153129 * Laboratory (LANL), which is operated by Los Alamos National Security, LLC
……@@ -179,6 +155,7 @@ typedef unsigned int uint;
179155 *
180156 * This is LANL Copyright Disclosure C14043/LA-CC-14-003
181157 */
158
182159/* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced
183160 * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National
184161 * Laboratory (LANL), which is operated by Los Alamos National Security, LLC
……@@ -334,6 +311,7 @@ typedef unsigned int uint;
334311 *
335312 * This is LANL Copyright Disclosure C14043/LA-CC-14-003
336313 */
314
337315/* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced
338316 * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National
339317 * Laboratory (LANL), which is operated by Los Alamos National Security, LLC
……@@ -458,14 +436,19 @@ typedef unsigned int uint;
458436 *
459437 * This is LANL Copyright Disclosure C14043/LA-CC-14-003
460438 */
439
461440static int reportLevel = 0;
441
462442const char *HashFactory_source;
443
463444const char *Hash_GetKernelSourceString() {
464445 return HashFactory_source;
465446}
447
466448size_t roundUpToNearest(size_t x, size_t r) {
467449 return (((x - 1) / r) + 1) * r;
468450}
451
469452int modularPow(int base, int exponent, int modulus) {
470453 int result = 1;
471454 while (exponent) {
……@@ -476,6 +459,7 @@ int modularPow(int base, int exponent, int modulus) {
476459 }
477460 return result;
478461}
462
479463int largestProthPrimeUnder(int N) {
480464 if (N < 4) {
481465 return N;
……@@ -506,6 +490,7 @@ int largestProthPrimeUnder(int N) {
506490 }
507491 return 3;
508492}
493
509494int smallestProthPrimeAbove(int N) {
510495 if (N < 4) {
511496 return N;
……@@ -536,6 +521,7 @@ int smallestProthPrimeAbove(int N) {
536521 }
537522 return 3;
538523}
524
539525int intLog2(int n) {
540526 int result = 0;
541527 while (n >>= 1) {
……@@ -543,12 +529,15 @@ int intLog2(int n) {
543529 }
544530 return result;
545531}
532
546533void Hash_SetReportLevel(int level) {
547534 reportLevel = level;
548535}
536
549537int Hash_GetReportLevel() {
550538 return reportLevel;
551539}
540
552541char *Hash_ExitCodeString(int exitCode) {
553542 switch (exitCode) {
554543 case HASH_EXIT_CODE_NORMAL:
……@@ -567,6 +556,7 @@ char *Hash_ExitCodeString(int exitCode) {
567556 return "Unknown";
568557 }
569558}
559
570560void Hash_ExitCodeDebug(int exitCode) {
571561 if (exitCode != HASH_EXIT_CODE_NORMAL) {
572562 printf("HashExitCode: %s\n", Hash_ExitCodeString(exitCode));
……@@ -1052,11 +1042,11 @@ int intintIdentityPerfectHash_InnerInsertSingle(char *tableData, int key,
10521042 index =
10531043 intintHash_CompressIdentity(((intintIdentityPerfectHash_TableData *)
10541044 tableData)->compressFuncData, key);
1055 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
1056 buckets[index].
1057 key = key;
1058 HASH_BUCKET_STATUS_EMPTY;}
1059 ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
1045 if (((buckets[index].key ==
1046 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
1047 key,
1048 HASH_BUCKET_STATUS_EMPTY) :
1049 buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
10601050 if (key == buckets[index].key) {
10611051 exitCode = HASH_SEARCH_CODE_MATCH;
10621052 } else {
……@@ -1093,13 +1083,11 @@ int intintIdentityPerfectHash_InnerInsert(char *tableData,
10931083 key = keys[i];
10941084 index =
10951085 intintHash_CompressIdentity(((intintIdentityPerfectHash_TableData *) tableData)->compressFuncData, key);
1096 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
1097 buckets
1098 [index].
1099 key =
1100 key;
1101 HASH_BUCKET_STATUS_EMPTY;}
1102 ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
1086 if (((buckets[index].key ==
1087 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
1088 key,
1089 HASH_BUCKET_STATUS_EMPTY) :
1090 buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
11031091 if (key == buckets[index].key) {
11041092 exitCode = HASH_SEARCH_CODE_MATCH;
11051093 } else {
……@@ -1131,11 +1119,11 @@ int intintIdentityPerfectHash_InnerInsertSingleNoOverwrite(char *tableData,
11311119 index =
11321120 intintHash_CompressIdentity(((intintIdentityPerfectHash_TableData *)
11331121 tableData)->compressFuncData, key);
1134 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
1135 buckets[index].
1136 key = key;
1137 HASH_BUCKET_STATUS_EMPTY;}
1138 ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
1122 if (((buckets[index].key ==
1123 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
1124 key,
1125 HASH_BUCKET_STATUS_EMPTY) :
1126 buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
11391127 if (key == buckets[index].key) {
11401128 exitCode = HASH_SEARCH_CODE_MATCH;
11411129 } else {
……@@ -1171,13 +1159,11 @@ int intintIdentityPerfectHash_InnerInsertNoOverwrite(char *tableData,
11711159 key = keys[i];
11721160 index =
11731161 intintHash_CompressIdentity(((intintIdentityPerfectHash_TableData *) tableData)->compressFuncData, key);
1174 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
1175 buckets
1176 [index].
1177 key =
1178 key;
1179 HASH_BUCKET_STATUS_EMPTY;}
1180 ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
1162 if (((buckets[index].key ==
1163 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
1164 key,
1165 HASH_BUCKET_STATUS_EMPTY) :
1166 buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
11811167 if (key == buckets[index].key) {
11821168 exitCode = HASH_SEARCH_CODE_MATCH;
11831169 } else {
……@@ -2579,13 +2565,11 @@ int intintLCGLinearOpenCompactHash_InnerInsertSingle(char *tableData, int key,
25792565 c) %
25802566 ((intintLCGLinearOpenCompactHash_TableData *) tableData)->
25812567 numBuckets);
2582 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
2583 buckets
2584 [index].
2585 key =
2586 key;
2587 HASH_BUCKET_STATUS_EMPTY;}
2588 ): buckets[index].key) == HASH_BUCKET_STATUS_EMPTY) {
2568 if (((buckets[index].key ==
2569 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
2570 key,
2571 HASH_BUCKET_STATUS_EMPTY) :
2572 buckets[index].key) == HASH_BUCKET_STATUS_EMPTY) {
25892573 exitCode = HASH_SEARCH_CODE_EMPTY;
25902574 break;
25912575 } else if (key == buckets[index].key) {
……@@ -2635,14 +2619,11 @@ int intintLCGLinearOpenCompactHash_InnerInsert(char *tableData,
26352619 c) %
26362620 ((intintLCGLinearOpenCompactHash_TableData *)
26372621 tableData)->numBuckets);
2638 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
2639 buckets
2640 [index].
2641 key
2642 =
2643 key;
2644 HASH_BUCKET_STATUS_EMPTY;}
2645 ): buckets[index].key) ==
2622 if (((buckets[index].key ==
2623 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
2624 key,
2625 HASH_BUCKET_STATUS_EMPTY)
2626 : buckets[index].key) ==
26462627 HASH_BUCKET_STATUS_EMPTY) {
26472628 exitCode = HASH_SEARCH_CODE_EMPTY;
26482629 break;
……@@ -2688,13 +2669,11 @@ int intintLCGLinearOpenCompactHash_InnerInsertSingleNoOverwrite(char *tableData,
26882669 c) %
26892670 ((intintLCGLinearOpenCompactHash_TableData *) tableData)->
26902671 numBuckets);
2691 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
2692 buckets
2693 [index].
2694 key =
2695 key;
2696 HASH_BUCKET_STATUS_EMPTY;}
2697 ): buckets[index].key) == HASH_BUCKET_STATUS_EMPTY) {
2672 if (((buckets[index].key ==
2673 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
2674 key,
2675 HASH_BUCKET_STATUS_EMPTY) :
2676 buckets[index].key) == HASH_BUCKET_STATUS_EMPTY) {
26982677 exitCode = HASH_SEARCH_CODE_EMPTY;
26992678 break;
27002679 } else if (key == buckets[index].key) {
……@@ -2744,14 +2723,11 @@ int intintLCGLinearOpenCompactHash_InnerInsertNoOverwrite(char *tableData,
27442723 c) %
27452724 ((intintLCGLinearOpenCompactHash_TableData *)
27462725 tableData)->numBuckets);
2747 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
2748 buckets
2749 [index].
2750 key
2751 =
2752 key;
2753 HASH_BUCKET_STATUS_EMPTY;}
2754 ): buckets[index].key) ==
2726 if (((buckets[index].key ==
2727 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
2728 key,
2729 HASH_BUCKET_STATUS_EMPTY)
2730 : buckets[index].key) ==
27552731 HASH_BUCKET_STATUS_EMPTY) {
27562732 exitCode = HASH_SEARCH_CODE_EMPTY;
27572733 break;
……@@ -3452,13 +3428,11 @@ int intintLCGQuadraticOpenCompactHash_InnerInsertSingle(char *tableData,
34523428 c) %
34533429 ((intintLCGQuadraticOpenCompactHash_TableData *)
34543430 tableData)->numBuckets);
3455 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
3456 buckets
3457 [index].
3458 key =
3459 key;
3460 HASH_BUCKET_STATUS_EMPTY;}
3461 ): buckets[index].key) == HASH_BUCKET_STATUS_EMPTY) {
3431 if (((buckets[index].key ==
3432 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
3433 key,
3434 HASH_BUCKET_STATUS_EMPTY) :
3435 buckets[index].key) == HASH_BUCKET_STATUS_EMPTY) {
34623436 exitCode = HASH_SEARCH_CODE_EMPTY;
34633437 break;
34643438 } else if (key == buckets[index].key) {
……@@ -3511,14 +3485,11 @@ int intintLCGQuadraticOpenCompactHash_InnerInsert(char *tableData,
35113485 c) %
35123486 ((intintLCGQuadraticOpenCompactHash_TableData *)
35133487 tableData)->numBuckets);
3514 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
3515 buckets
3516 [index].
3517 key
3518 =
3519 key;
3520 HASH_BUCKET_STATUS_EMPTY;}
3521 ): buckets[index].key) ==
3488 if (((buckets[index].key ==
3489 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
3490 key,
3491 HASH_BUCKET_STATUS_EMPTY)
3492 : buckets[index].key) ==
35223493 HASH_BUCKET_STATUS_EMPTY) {
35233494 exitCode = HASH_SEARCH_CODE_EMPTY;
35243495 break;
……@@ -3568,13 +3539,11 @@ int intintLCGQuadraticOpenCompactHash_InnerInsertSingleNoOverwrite(char
35683539 c) %
35693540 ((intintLCGQuadraticOpenCompactHash_TableData *)
35703541 tableData)->numBuckets);
3571 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
3572 buckets
3573 [index].
3574 key =
3575 key;
3576 HASH_BUCKET_STATUS_EMPTY;}
3577 ): buckets[index].key) == HASH_BUCKET_STATUS_EMPTY) {
3542 if (((buckets[index].key ==
3543 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
3544 key,
3545 HASH_BUCKET_STATUS_EMPTY) :
3546 buckets[index].key) == HASH_BUCKET_STATUS_EMPTY) {
35783547 exitCode = HASH_SEARCH_CODE_EMPTY;
35793548 break;
35803549 } else if (key == buckets[index].key) {
……@@ -3628,14 +3597,11 @@ int intintLCGQuadraticOpenCompactHash_InnerInsertNoOverwrite(char *tableData,
36283597 c) %
36293598 ((intintLCGQuadraticOpenCompactHash_TableData *)
36303599 tableData)->numBuckets);
3631 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
3632 buckets
3633 [index].
3634 key
3635 =
3636 key;
3637 HASH_BUCKET_STATUS_EMPTY;}
3638 ): buckets[index].key) ==
3600 if (((buckets[index].key ==
3601 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
3602 key,
3603 HASH_BUCKET_STATUS_EMPTY)
3604 : buckets[index].key) ==
36393605 HASH_BUCKET_STATUS_EMPTY) {
36403606 exitCode = HASH_SEARCH_CODE_EMPTY;
36413607 break;
……@@ -4145,33 +4111,6 @@ int intintLCGQuadraticOpenCompactCLHash_BufferInsertNoOverwrite(intintHash_Table
41454111}
41464112const char *HashFactory_source =
41474113"\n"
4148"/* Copyright (C) 1991-2012 Free Software Foundation, Inc.\n"
4149" This file is part of the GNU C Library.\n"
4150"\n"
4151" The GNU C Library is free software; you can redistribute it and/or\n"
4152" modify it under the terms of the GNU Lesser General Public\n"
4153" License as published by the Free Software Foundation; either\n"
4154" version 2.1 of the License, or (at your option) any later version.\n"
4155"\n"
4156" The GNU C Library is distributed in the hope that it will be useful,\n"
4157" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
4158" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
4159" Lesser General Public License for more details.\n"
4160"\n"
4161" You should have received a copy of the GNU Lesser General Public\n"
4162" License along with the GNU C Library; if not, see\n"
4163" <http://www.gnu.org/licenses/>. */\n"
4164"/* This header is separate from features.h so that the compiler can\n"
4165" include it implicitly at the start of every compilation. It must\n"
4166" not itself include <features.h> or any other header that includes\n"
4167" <features.h> because the implicit include comes before any feature\n"
4168" test macros that may be defined in a source file before it first\n"
4169" explicitly includes a system header. GCC knows the name of this\n"
4170" header in order to preinclude it. */\n"
4171"/* We do support the IEC 559 math functionality, real and complex. */\n"
4172"/* wchar_t uses ISO/IEC 10646 (2nd ed., published 2011-03-15) /\n"
4173" Unicode 6.0. */\n"
4174"/* We do not support C11 <threads.h>. */\n"
41754114"/* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced\n"
41764115" * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National \n"
41774116" * Laboratory (LANL), which is operated by Los Alamos National Security, LLC\n"
……@@ -4203,6 +4142,7 @@ const char *HashFactory_source =
42034142" *\n"
42044143" * This is LANL Copyright Disclosure C14043/LA-CC-14-003\n"
42054144" */\n"
4145"\n"
42064146"int intintIdentityPerfectCLHash_InsertSingle(__global char *tableData,\n"
42074147" int key, int value);\n"
42084148"int intintIdentityPerfectCLHash_InnerInsertSingle(__global char *tableData,\n"
……@@ -4400,6 +4340,7 @@ const char *HashFactory_source =
44004340" __global int *values);\n"
44014341"int intintHash_InsertSingleNoOverwrite(__global char *tableData, int key,\n"
44024342" int value);\n"
4343"\n"
44034344"#define HASH_REPORT_NEVER /**/ 0\n"
44044345"#define HASH_REPORT_CYCLE /**/ 1\n"
44054346"#define HASH_REPORT_END /****/ 2\n"
……@@ -4537,11 +4478,11 @@ const char *HashFactory_source =
45374478" intintHash_CompressIdentity(((__global\n"
45384479" intintIdentityPerfectCLHash_TableData\n"
45394480" *) tableData)->compressFuncData, key);\n"
4540" if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {\n"
4541" buckets[index].\n"
4542" key = key;\n"
4543" HASH_BUCKET_STATUS_EMPTY;}\n"
4544" ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {\n"
4481" if (((buckets[index].key ==\n"
4482" HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =\n"
4483" key,\n"
4484" HASH_BUCKET_STATUS_EMPTY) :\n"
4485" buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {\n"
45454486" if (key == buckets[index].key) {\n"
45464487" exitCode = HASH_SEARCH_CODE_MATCH;\n"
45474488" } else {\n"
……@@ -4582,13 +4523,11 @@ const char *HashFactory_source =
45824523" intintIdentityPerfectCLHash_TableData\n"
45834524" *) tableData)->\n"
45844525" compressFuncData, key);\n"
4585" if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {\n"
4586" buckets\n"
4587" [index].\n"
4588" key =\n"
4589" key;\n"
4590" HASH_BUCKET_STATUS_EMPTY;}\n"
4591" ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {\n"
4526" if (((buckets[index].key ==\n"
4527" HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =\n"
4528" key,\n"
4529" HASH_BUCKET_STATUS_EMPTY) :\n"
4530" buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {\n"
45924531" if (key == buckets[index].key) {\n"
45934532" exitCode = HASH_SEARCH_CODE_MATCH;\n"
45944533" } else {\n"
……@@ -4623,11 +4562,11 @@ const char *HashFactory_source =
46234562" intintHash_CompressIdentity(((__global\n"
46244563" intintIdentityPerfectCLHash_TableData\n"
46254564" *) tableData)->compressFuncData, key);\n"
4626" if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {\n"
4627" buckets[index].\n"
4628" key = key;\n"
4629" HASH_BUCKET_STATUS_EMPTY;}\n"
4630" ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {\n"
4565" if (((buckets[index].key ==\n"
4566" HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =\n"
4567" key,\n"
4568" HASH_BUCKET_STATUS_EMPTY) :\n"
4569" buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {\n"
46314570" if (key == buckets[index].key) {\n"
46324571" exitCode = HASH_SEARCH_CODE_MATCH;\n"
46334572" } else {\n"
……@@ -4667,13 +4606,11 @@ const char *HashFactory_source =
46674606" intintIdentityPerfectCLHash_TableData\n"
46684607" *) tableData)->\n"
46694608" compressFuncData, key);\n"
4670" if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {\n"
4671" buckets\n"
4672" [index].\n"
4673" key =\n"
4674" key;\n"
4675" HASH_BUCKET_STATUS_EMPTY;}\n"
4676" ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {\n"
4609" if (((buckets[index].key ==\n"
4610" HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =\n"
4611" key,\n"
4612" HASH_BUCKET_STATUS_EMPTY) :\n"
4613" buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {\n"
46774614" if (key == buckets[index].key) {\n"
46784615" exitCode = HASH_SEARCH_CODE_MATCH;\n"
46794616" } else {\n"
HashFactory/HashFactory.cl +22 -51
……@@ -1,31 +1,4 @@
11
2/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18/* This header is separate from features.h so that the compiler can
19 include it implicitly at the start of every compilation. It must
20 not itself include <features.h> or any other header that includes
21 <features.h> because the implicit include comes before any feature
22 test macros that may be defined in a source file before it first
23 explicitly includes a system header. GCC knows the name of this
24 header in order to preinclude it. */
25/* We do support the IEC 559 math functionality, real and complex. */
26/* wchar_t uses ISO/IEC 10646 (2nd ed., published 2011-03-15) /
27 Unicode 6.0. */
28/* We do not support C11 <threads.h>. */
292/* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced
303 * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National
314 * Laboratory (LANL), which is operated by Los Alamos National Security, LLC
……@@ -57,6 +30,7 @@
5730 *
5831 * This is LANL Copyright Disclosure C14043/LA-CC-14-003
5932 */
33
6034int intintIdentityPerfectCLHash_InsertSingle(__global char *tableData,
6135 int key, int value);
6236int intintIdentityPerfectCLHash_InnerInsertSingle(__global char *tableData,
……@@ -254,6 +228,7 @@ int intintHash_InsertNoOverwrite(__global char *tableData,
254228 __global int *values);
255229int intintHash_InsertSingleNoOverwrite(__global char *tableData, int key,
256230 int value);
231
257232#define HASH_REPORT_NEVER /**/ 0
258233#define HASH_REPORT_CYCLE /**/ 1
259234#define HASH_REPORT_END /****/ 2
……@@ -391,11 +366,11 @@ int intintIdentityPerfectCLHash_InnerInsertSingle(__global char *tableData,
391366 intintHash_CompressIdentity(((__global
392367 intintIdentityPerfectCLHash_TableData
393368 *) tableData)->compressFuncData, key);
394 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
395 buckets[index].
396 key = key;
397 HASH_BUCKET_STATUS_EMPTY;}
398 ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
369 if (((buckets[index].key ==
370 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
371 key,
372 HASH_BUCKET_STATUS_EMPTY) :
373 buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
399374 if (key == buckets[index].key) {
400375 exitCode = HASH_SEARCH_CODE_MATCH;
401376 } else {
……@@ -436,13 +411,11 @@ int intintIdentityPerfectCLHash_InnerInsert(__global char *tableData,
436411 intintIdentityPerfectCLHash_TableData
437412 *) tableData)->
438413 compressFuncData, key);
439 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
440 buckets
441 [index].
442 key =
443 key;
444 HASH_BUCKET_STATUS_EMPTY;}
445 ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
414 if (((buckets[index].key ==
415 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
416 key,
417 HASH_BUCKET_STATUS_EMPTY) :
418 buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
446419 if (key == buckets[index].key) {
447420 exitCode = HASH_SEARCH_CODE_MATCH;
448421 } else {
……@@ -477,11 +450,11 @@ int intintIdentityPerfectCLHash_InnerInsertSingleNoOverwrite(__global char
477450 intintHash_CompressIdentity(((__global
478451 intintIdentityPerfectCLHash_TableData
479452 *) tableData)->compressFuncData, key);
480 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
481 buckets[index].
482 key = key;
483 HASH_BUCKET_STATUS_EMPTY;}
484 ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
453 if (((buckets[index].key ==
454 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
455 key,
456 HASH_BUCKET_STATUS_EMPTY) :
457 buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
485458 if (key == buckets[index].key) {
486459 exitCode = HASH_SEARCH_CODE_MATCH;
487460 } else {
……@@ -521,13 +494,11 @@ int intintIdentityPerfectCLHash_InnerInsertNoOverwrite(__global char *tableData,
521494 intintIdentityPerfectCLHash_TableData
522495 *) tableData)->
523496 compressFuncData, key);
524 if (((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ( {
525 buckets
526 [index].
527 key =
528 key;
529 HASH_BUCKET_STATUS_EMPTY;}
530 ): buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
497 if (((buckets[index].key ==
498 HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key =
499 key,
500 HASH_BUCKET_STATUS_EMPTY) :
501 buckets[index].key) != HASH_BUCKET_STATUS_EMPTY) {
531502 if (key == buckets[index].key) {
532503 exitCode = HASH_SEARCH_CODE_MATCH;
533504 } else {
HashFactory/HashFactory.h +8 -27
……@@ -1,31 +1,4 @@
11
2/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18/* This header is separate from features.h so that the compiler can
19 include it implicitly at the start of every compilation. It must
20 not itself include <features.h> or any other header that includes
21 <features.h> because the implicit include comes before any feature
22 test macros that may be defined in a source file before it first
23 explicitly includes a system header. GCC knows the name of this
24 header in order to preinclude it. */
25/* We do support the IEC 559 math functionality, real and complex. */
26/* wchar_t uses ISO/IEC 10646 (2nd ed., published 2011-03-15) /
27 Unicode 6.0. */
28/* We do not support C11 <threads.h>. */
292/* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced
303 * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National
314 * Laboratory (LANL), which is operated by Los Alamos National Security, LLC
……@@ -63,6 +36,7 @@
6336 * @date Thu Jun 6 2013
6437 */
6538//
39
6640#ifndef HASH_H
6741#define HASH_H
6842//
……@@ -197,6 +171,7 @@ int clFinish(int command_queue);
197171#define HASH_BUCKET_STATUS_EMPTY /**/ -1
198172#define HASH_BUCKET_STATUS_FULL /***/ -2
199173#define HASH_BUCKET_STATUS_LOCK /***/ -3
174
200175/**
201176 * Hash_ExitCodeString will return a string representation of the given exit
202177 * code.
……@@ -206,6 +181,7 @@ int clFinish(int command_queue);
206181 * @return A string representation of that exit code.
207182 */
208183char *Hash_ExitCodeString(int exitCode);
184
209185/**
210186 * Hash_ExitCodeDebug will print a string representation of the given exit code
211187 * if it is not EXIT_CODE_NORMAL.
……@@ -213,6 +189,7 @@ char *Hash_ExitCodeString(int exitCode);
213189 * @param exitCode
214190 */
215191void Hash_ExitCodeDebug(int exitCode);
192
216193/**
217194 * Hash_SetReportLevel sets a static report level variable in hash.c. It should
218195 * be called before hash tables are created.
……@@ -220,6 +197,7 @@ void Hash_ExitCodeDebug(int exitCode);
220197 * @param level The level of data collection desired.
221198 */
222199void Hash_SetReportLevel(int level);
200
223201/**
224202 * Hash_GetReportLevel gets this variable.
225203 *
……@@ -235,9 +213,11 @@ void Hash_SetReportLevel(int level);
235213 * last important call.
236214 */
237215int Hash_GetReportLevel();
216
238217const char *Hash_GetKernelSourceString();
239218int smallestProthPrimeAbove(int N);
240219int largestProthPrimeUnder(int N);
220
241221typedef struct intintHash_Table_ intintHash_Table;
242222typedef struct intintCLHash_Table_ intintCLHash_Table;
243223typedef struct intintHash_Factory_ intintHash_Factory;
……@@ -597,4 +577,5 @@ int intintLCGQuadraticOpenCompactCLHash_BufferInsertNoOverwrite(intintHash_Table
597577 keysBuffer,
598578 cl_mem
599579 valuesBuffer);
580
600581#endif
HashFactory/baseHash.cm +1 -1
……@@ -125,7 +125,7 @@
125125
126126#define HASH_READ_KEY_EXP (buckets[index].key)
127127
128#define CMPXCHG_HASH_READ_KEY_EXP ((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? ({buckets[index].key = key; HASH_BUCKET_STATUS_EMPTY;}) : buckets[index].key)\
128#define CMPXCHG_HASH_READ_KEY_EXP ((buckets[index].key == HASH_BUCKET_STATUS_EMPTY) ? (buckets[index].key = key, HASH_BUCKET_STATUS_EMPTY) : buckets[index].key)\
129129
130130#define BASE_HASH_METHODS(NAME, MODIFIER, KEY_TYPE, VALUE_TYPE, COMPRESS_FUNC, COMPRESS_FUNC_DATA, SEARCH_EXP, READ_KEY_EXP, CL_GLOBAL, ...) \
131131 \