11enum ModeFunction {
2- Benchmark , ZeroBytes , Matching , Leading , Range , Mirror , Doubles , LeadingRange
2+ Benchmark , ZeroBytes , Matching , Leading , Range , Mirror , Doubles , LeadingRange , StartEnd
33};
44
55typedef struct {
@@ -23,6 +23,7 @@ void eradicate2_score_matching(const uchar * const hash, __global result * const
2323void eradicate2_score_range (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round );
2424void eradicate2_score_leadingrange (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round );
2525void eradicate2_score_mirror (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round );
26+ void eradicate2_score_startend (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round );
2627void eradicate2_score_doubles (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round );
2728
2829__kernel void eradicate2_iterate (__global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round ) {
@@ -69,6 +70,10 @@ __kernel void eradicate2_iterate(__global result * const pResult, __global const
6970 eradicate2_score_mirror (h .b + 12 , pResult , pMode , scoreMax , deviceIndex , round );
7071 break ;
7172
73+ case StartEnd :
74+ eradicate2_score_startend (h .b + 12 , pResult , pMode , scoreMax , deviceIndex , round );
75+ break ;
76+
7277 case Doubles :
7378 eradicate2_score_doubles (h .b + 12 , pResult , pMode , scoreMax , deviceIndex , round );
7479 break ;
@@ -228,6 +233,37 @@ void eradicate2_score_mirror(const uchar * const hash, __global result * const p
228233 eradicate2_result_update (hash , pResult , score , scoreMax , deviceIndex , round );
229234}
230235
236+ void eradicate2_score_startend (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round ) {
237+ const size_t id = get_global_id (0 );
238+ int score = 0 ;
239+ int err = 0 ;
240+
241+ for (int i = 0 ; i < 10 && !err ; ++ i ) {
242+ const uchar leftLeft = (hash [i ] & 0xF0 ) >> 4 ;
243+ const uchar leftRight = (hash [i ] & 0x0F );
244+
245+ const uchar rightLeft = (hash [19 - i ] & 0xF0 ) >> 4 ;
246+ const uchar rightRight = (hash [19 - i ] & 0x0F );
247+
248+ if (leftLeft != rightRight || leftLeft != pMode -> data1 [0 ]) {
249+ err = 1 ;
250+ break ;
251+ }
252+
253+ score += 2 ;
254+
255+ if (leftRight != rightLeft || leftRight != pMode -> data1 [0 ]) {
256+ if (leftRight == pMode -> data1 [0 ]) ++ score ;
257+ err = 1 ;
258+ break ;
259+ }
260+
261+ score += 2 ;
262+ }
263+
264+ eradicate2_result_update (hash , pResult , score , scoreMax , deviceIndex , round );
265+ }
266+
231267void eradicate2_score_doubles (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round ) {
232268 const size_t id = get_global_id (0 );
233269 int score = 0 ;
0 commit comments