本文整理汇总了C++中OE::putmem方法的典型用法代码示例。如果您正苦于以下问题:C++ OE::putmem方法的具体用法?C++ OE::putmem怎么用?C++ OE::putmem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OE
的用法示例。
在下文中一共展示了OE::putmem方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: txt_book_fft
/*!
* {n} is the nth root number and f has that degree.
*
* {f} is an n vector of gf2^8 elements
*
* {omega} is root of unity of length n with 1, omega, omega^2 etc...
*
* TODO(rwl):
*
* I) Optimize the 1 of the omega list no need to have it there.
* II)
*/
void txt_book_fft(OE oe, uint n, byte * f, byte * omegas, byte * result) {
byte * r0 = 0;
byte * r1star = 0;
byte * new_omegas = 0;
byte * r0_result = 0;
byte * r1star_result = 0;
uint idx = 0;
byte omega = omegas[1];
byte q = 0;
// base case
if (n == 1) {
result[0] = f[0];
return;
}
r0 = oe->getmem(n/2+1);
r1star = oe->getmem(n/2+1);
// divide
for(idx = 0;idx<n/2;++idx) {
q = add(f[idx],f[idx+n/2]);
r0[idx] = q;
r1star[idx] = multiply(q,omegas[idx]);
}
if (n%2) {
r0[n/2] = f[n/2];
r1star[n/2]=multiply(f[n/2],omegas[n/2]);
}
new_omegas = oe->getmem(n);
r0_result = oe->getmem(n);
r1star_result = oe->getmem(n);
for(idx = 1;idx<n;++idx) {
new_omegas[idx] = multiply(omegas[idx],omega);
}
new_omegas[idx] = 1;
txt_book_fft(oe, n/2, r0, new_omegas, r0_result);
txt_book_fft(oe, n/2, r1star, new_omegas,r1star_result);
for(idx = 0;idx < 2*(n/2);idx+=2) {
result[idx] = eval_pol(r0_result,n/2,omegas[idx/2]);
result[idx+1]= eval_pol(r1star_result,n/2,omegas[idx/2]);
}
oe->putmem(r0);
oe->putmem(r1star);
oe->putmem(r0_result);
oe->putmem(r1star_result);
oe->putmem(new_omegas);
return;
}
示例2: tokenize_file
static int tokenize_file(OE oe) {
uint lbuffer = 1060365;
uint ands = 0, xors = 0, invs = 0, nums = 0, tokens = 0;
Tokenizer tk = 0;
Token tok = {0};
byte * buffer = oe->getmem(lbuffer);
uint fp = 0;
oe->open("file ../test/AES",&fp);
oe->read(fp,buffer,&lbuffer);
oe->close(fp);
tk = FunCallTokenizer_New(oe);
tk->start(buffer,lbuffer);
do {
tk->nextToken(&tok);
if (tok.type == INV) invs += 1;
if (tok.type == AND) ands +=1;
if (tok.type == XOR) xors += 1;
if (tok.type == NUM) nums += 1;
tokens++;
} while(tok.type != DONE);
DBG_P(oe,"\nANDS: %u\nXORS: %u\nINVS: %u\nNUMS: %u\nTOKENS: %u\n",ands,xors,invs,nums,tokens);
oe->putmem(buffer);
return ands == 6800 && xors == 24448 && nums == 139136 && tokens == 172076 && invs == 1691;
}
示例3: Cmaphore_destroy
void Cmaphore_destroy(Cmaphore * c) {
OE oe = 0;
Cmaphore s = 0;
if (!c) return;
if (!*c) return;
s = *c;
oe = s->oe;
// inform all down's that we are destroying this semaphore
oe->lock(s->lock);
s->oe = 0;
oe->unlock(s->lock);
// give all other threads a chance to run.
oe->yieldthread();
// Really now we destroy it !
oe->lock(s->lock);
s->count = 0;
oe->destroymutex(&s->lock);
zeromem(s, sizeof(*s));
*c = 0;
oe->putmem(s);
}
示例4: Aes_destroy
void Aes_destroy(OE oe, Aes * aes) {
if (!aes) return;
if (!*aes) return;
oe->putmem(*aes);
*aes = 0;
}
示例5: MapEntry_destroy
void MapEntry_destroy(MapEntry * entry) {
OE oe = 0;
if (!entry) return;
if (!*entry) return;
oe = (*entry)->oe;
oe->putmem(*entry);
}
示例6: FDEntry_destroy
static void FDEntry_destroy(OE oe, FDEntry * ent) {
FDEntry e = 0;
if (!ent) return;
if (!*ent) return;
e = *ent;
oe->putmem(e);
*ent = 0;
}
示例7: test_large_file
static int test_large_file(OE oe) {
_Bool ok = 1;
uint lbuffer = 1060365;
uint ands = 0, xors = 0, nums = 0, tokens = 0;
Tokenizer tk = 0;CircuitParser cp = 0;
List ast = 0;
byte * buffer = oe->getmem(lbuffer);
uint fp = 0, i = 0;
CircuitVisitor cv = 0;
Map input_gates = 0;
List aoig = 0;
DateTime clock = 0;
ull start = 0;
oe->open("file ../test/AES",&fp);
cv = InputGateVisitor_New(oe);
clock = DateTime_New(oe);
start = clock->getMicroTime();
oe->read(fp,buffer,&lbuffer);
oe->close(fp);
DBG_P(oe,"reading file took %u microseconds",clock->getMicroTime()-start);
tk = FunCallTokenizer_New(oe);
cp = CircuitParser_New(oe,tk);
start = clock->getMicroTime();
ast = cp->parseSource(buffer,lbuffer);
DBG_P(oe,"parsing circuit took %u microseconds.",clock->getMicroTime()-start);
oe->putmem(buffer);
start = clock->getMicroTime();
input_gates = cv->visit(ast);
AssertTrue(input_gates != 0)
aoig = input_gates->get_keys();
if (aoig) {
DBG_P(oe,"#Input: %u analysis took %u microseconds",aoig->size(),clock->getMicroTime()-start);
}
AssertTrue( aoig != 0 );
test_end:
return ok;
}