Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
mie Namespace Reference

Namespaces

namespace  local
 
namespace  util
 

Classes

class  Fp
 
class  VsintT
 
struct  VuintT
 
class  ZmZ
 

Typedefs

typedef uint32_t Unit
 
typedef VuintT< local::FixedBuffer< mie::Unit, MIE_ZM_VUINT_BIT_LEN > > Vuint
 
typedef VsintT< VuintVsint
 

Functions

template<class T , class S >
T power (const T &x, const S &y)
 
void zmInit ()
 

Detailed Description

Fp : finite field with characteristic 254bit prime t = - 2^62 - 2^55 + 2^0 p = 36*t*t*t*t + 36*t*t*t + 24*t*t + 6*t + 1

Typedef Documentation

◆ Unit

Definition at line 66 of file zm.h.

◆ Vsint

Definition at line 1162 of file zm.h.

◆ Vuint

typedef VuintT<local::FixedBuffer<mie::Unit, MIE_ZM_VUINT_BIT_LEN> > mie::Vuint

Definition at line 1161 of file zm.h.

Function Documentation

◆ power()

template<class T , class S >
T mie::power ( const T & x,
const S & y )

return pow(x, y)

Definition at line 1389 of file zm.h.

1390{
1391 typedef typename mie::util::IntTag<S> Tag;
1392 typedef typename Tag::value_type value_type;
1393 T t(x);
1394 T out = 1;
1395 for (size_t i = 0, n = Tag::getBlockSize(y); i < n; i++) {
1396 value_type v = Tag::getBlock(y, i);
1397 int m = (int)sizeof(value_type) * 8;
1398 if (i == n - 1) {
1399 // avoid unused multiplication
1400 while (m > 0 && (v & (value_type(1) << (m - 1))) == 0) {
1401 m--;
1402 }
1403 }
1404 for (int j = 0; j < m; j++) {
1405 if (v & (value_type(1) << j)) {
1406 out *= t;
1407 }
1408 t *= t;
1409 }
1410 }
1411 return out;
1412}
uint8_t value_type
Definition types.hpp:24
#define T(meth, val, expected)
uint16_t j
Here is the caller graph for this function:

◆ zmInit()

void mie::zmInit ( )

Definition at line 557 of file zm.cpp.

558{
559#ifdef MIE_USE_X64ASM
560 static bool isInit = false;
561 if (isInit) return;
562 isInit = true;
563 try {
564 static Code code;
565 } catch (std::exception& e) {
566 fprintf(stderr, "zmInit ERR:%s\n", e.what());
567 exit(1);
568 }
569#endif
570}
Definition bench.cpp:18
Here is the caller graph for this function: