@@ -87,6 +87,33 @@ class blst_384_t {
87
87
}
88
88
inline blst_384_t (int a) : blst_384_t((uint64_t )a) {}
89
89
90
+ #if defined(__CUDACC__) || defined(__HIPCC__)
91
+ template <typename ... Ts>
92
+ constexpr blst_384_t (limb_t a0, Ts... arr)
93
+ {
94
+ limb_t temp[11 ] = {arr...};
95
+
96
+ if (sizeof ...(arr) < 6 ) {
97
+ val[0 ] = a0;
98
+ val[1 ] = temp[0 ];
99
+ val[2 ] = temp[1 ];
100
+ val[3 ] = temp[2 ];
101
+ val[4 ] = temp[3 ];
102
+ val[5 ] = temp[4 ];
103
+ } else {
104
+ val[0 ] = a0 | (temp[0 ] << 32 );
105
+ val[1 ] = temp[1 ] | (temp[2 ] << 32 );
106
+ val[2 ] = temp[3 ] | (temp[4 ] << 32 );
107
+ val[3 ] = temp[5 ] | (temp[6 ] << 32 );
108
+ val[4 ] = temp[7 ] | (temp[8 ] << 32 );
109
+ val[5 ] = temp[9 ] | (temp[10 ] << 32 );
110
+ }
111
+ }
112
+ #else
113
+ template <typename ... Ts>
114
+ constexpr blst_384_t (limb_t a0, Ts... arr) : vec{a0, arr...} {}
115
+ #endif
116
+
90
117
inline void to_scalar (pow_t & scalar) const
91
118
{
92
119
const union {
@@ -296,7 +323,7 @@ class blst_384_t {
296
323
*str++ = ' 0' , *str++ = ' x' ;
297
324
for (size_t i = 0 ; i < sizeof (obj); i++)
298
325
*str++ = hex_from_nibble (be[i]>>4 ), *str++ = hex_from_nibble (be[i]);
299
- *str = ' \0 ' ;
326
+ *str = ' \0 ' ;
300
327
301
328
return os << buf;
302
329
}
@@ -338,6 +365,29 @@ class blst_256_t {
338
365
}
339
366
inline blst_256_t (int a) : blst_256_t((uint64_t )a) {}
340
367
368
+ #if defined(__CUDACC__) || defined(__HIPCC__)
369
+ template <typename ... Ts>
370
+ constexpr blst_256_t (limb_t a0, Ts... arr)
371
+ {
372
+ limb_t temp[7 ] = {arr...};
373
+
374
+ if (sizeof ...(arr) < 4 ) {
375
+ val[0 ] = a0;
376
+ val[1 ] = temp[0 ];
377
+ val[2 ] = temp[1 ];
378
+ val[3 ] = temp[2 ];
379
+ } else {
380
+ val[0 ] = a0 | (temp[0 ] << 32 );
381
+ val[1 ] = temp[1 ] | (temp[2 ] << 32 );
382
+ val[2 ] = temp[3 ] | (temp[4 ] << 32 );
383
+ val[3 ] = temp[5 ] | (temp[6 ] << 32 );
384
+ }
385
+ }
386
+ #else
387
+ template <typename ... Ts>
388
+ constexpr blst_256_t (limb_t a0, Ts... arr) : vec{a0, arr...} {}
389
+ #endif
390
+
341
391
inline void to_scalar (pow_t & scalar) const
342
392
{
343
393
const union {
@@ -614,7 +664,7 @@ class blst_256_t {
614
664
*str++ = ' 0' , *str++ = ' x' ;
615
665
for (size_t i = 0 ; i < sizeof (obj); i++)
616
666
*str++ = hex_from_nibble (be[i]>>4 ), *str++ = hex_from_nibble (be[i]);
617
- *str = ' \0 ' ;
667
+ *str = ' \0 ' ;
618
668
619
669
return os << buf;
620
670
}
0 commit comments