本文整理匯總了C++中F2函數的典型用法代碼示例。如果您正苦於以下問題:C++ F2函數的具體用法?C++ F2怎麽用?C++ F2使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了F2函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: W
/* forward octave */
static inline void W(u32 *key, unsigned int i) {
u32 I;
key[6] ^= F1(key[7], Tr[i % 4][0], Tm[i][0]);
key[5] ^= F2(key[6], Tr[i % 4][1], Tm[i][1]);
key[4] ^= F3(key[5], Tr[i % 4][2], Tm[i][2]);
key[3] ^= F1(key[4], Tr[i % 4][3], Tm[i][3]);
key[2] ^= F2(key[3], Tr[i % 4][4], Tm[i][4]);
key[1] ^= F3(key[2], Tr[i % 4][5], Tm[i][5]);
key[0] ^= F1(key[1], Tr[i % 4][6], Tm[i][6]);
key[7] ^= F2(key[0], Tr[i % 4][7], Tm[i][7]);
}
示例2: cast5_encrypt
static void cast5_encrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf)
{
struct cast5_ctx *c = crypto_tfm_ctx(tfm);
const __be32 *src = (const __be32 *)inbuf;
__be32 *dst = (__be32 *)outbuf;
u32 l, r, t;
u32 I; /* used by the Fx macros */
u32 *Km;
u8 *Kr;
Km = c->Km;
Kr = c->Kr;
/* (L0,R0) <-- (m1...m64). (Split the plaintext into left and
* right 32-bit halves L0 = m1...m32 and R0 = m33...m64.)
*/
l = be32_to_cpu(src[0]);
r = be32_to_cpu(src[1]);
/* (16 rounds) for i from 1 to 16, compute Li and Ri as follows:
* Li = Ri-1;
* Ri = Li-1 ^ f(Ri-1,Kmi,Kri), where f is defined in Section 2.2
* Rounds 1, 4, 7, 10, 13, and 16 use f function Type 1.
* Rounds 2, 5, 8, 11, and 14 use f function Type 2.
* Rounds 3, 6, 9, 12, and 15 use f function Type 3.
*/
t = l; l = r; r = t ^ F1(r, Km[0], Kr[0]);
t = l; l = r; r = t ^ F2(r, Km[1], Kr[1]);
t = l; l = r; r = t ^ F3(r, Km[2], Kr[2]);
t = l; l = r; r = t ^ F1(r, Km[3], Kr[3]);
t = l; l = r; r = t ^ F2(r, Km[4], Kr[4]);
t = l; l = r; r = t ^ F3(r, Km[5], Kr[5]);
t = l; l = r; r = t ^ F1(r, Km[6], Kr[6]);
t = l; l = r; r = t ^ F2(r, Km[7], Kr[7]);
t = l; l = r; r = t ^ F3(r, Km[8], Kr[8]);
t = l; l = r; r = t ^ F1(r, Km[9], Kr[9]);
t = l; l = r; r = t ^ F2(r, Km[10], Kr[10]);
t = l; l = r; r = t ^ F3(r, Km[11], Kr[11]);
if (!(c->rr)) {
t = l; l = r; r = t ^ F1(r, Km[12], Kr[12]);
t = l; l = r; r = t ^ F2(r, Km[13], Kr[13]);
t = l; l = r; r = t ^ F3(r, Km[14], Kr[14]);
t = l; l = r; r = t ^ F1(r, Km[15], Kr[15]);
}
/* c1...c64 <-- (R16,L16). (Exchange final blocks L16, R16 and
* concatenate to form the ciphertext.) */
dst[0] = cpu_to_be32(r);
dst[1] = cpu_to_be32(l);
}
示例3: digitalWrite
void ChannelSelector::setCubiePower(bool mode)
{
if (mode == false) {
digitalWrite(PIN_CUBIEPOWER, LOW);
GLOBALS.cubie_power_enabled = false;
MDISPLAY.showMessage(F2("Power Off"));
}
else {
digitalWrite(PIN_CUBIEPOWER, HIGH);
GLOBALS.cubie_power_enabled = true;
MDISPLAY.showMessage(F2("Power On"));
}
}
示例4: q_promote
void
q_promote(
q_expr e)
{
q_expr leftTerm, rightTerm;
q_expr newTerm;
assert(e != NULL);
assert(e->kind == T_FNC);
assert(e->info.function->tag == Q_EXPR_AND);
leftTerm = q_leftPar(e);
rightTerm = q_rightPar(e);
q_disjunctify(leftTerm);
q_disjunctify(rightTerm);
if (q_isFnc(leftTerm,Q_EXPR_OR)) {
/* e = (A or B) and C ====> e = A and C or B and C */
newTerm = F2(Q_EXPR_AND,q_rightPar(leftTerm),q_exprCopy(rightTerm));
/* e = (A or B) and C; newTerm = B and C */
q_promote(newTerm);
q_swapRight(leftTerm,q_swapRight(e,newTerm));
/* e = (A or C) and (B and C); */
q_setTag(leftTerm,Q_EXPR_AND);
/* e = (A and C) and (B and C); */
q_promote(leftTerm);
q_setTag(e,Q_EXPR_OR);
/* e = (A and C) or (B and C); */
if (q_isFnc(rightTerm,Q_EXPR_OR)) {
/* e = (A and (C or D)) or (B and (C or D)); */
q_promote(leftTerm);
/* e = (A and C) or (A and D)) or (B and (C or D)); */
q_promote(newTerm);
/* e = ((A and C) or (A and D)) or ((B and C) or (A and D)); */
}
} else {
if (q_isFnc(rightTerm,Q_EXPR_OR)) {
/* e = A and (B or C) ====> e = A and B or A and C */
newTerm = F2(Q_EXPR_AND,q_exprCopy(leftTerm),q_leftPar(rightTerm));
/* e = A and (B or C); newTerm = A and B */
q_swapLeft(rightTerm,q_swapLeft(e,newTerm));
/* e = (A and B) and (A or C); */
q_setTag(rightTerm,Q_EXPR_AND);
/* e = (A and B) and (A and C); */
q_setTag(e,Q_EXPR_OR);
/* e = (A and B) or (A and C); */
}
}
}
示例5: rubikStep
void rubikStep(char *step)
{
u8 m=0;
for(m=0;step[m]!=0;m++)
{
switch(step[m])
{
case 7:allright90();break;
case 11:F1();break;
case 12:F2();break;
case 13:F3();break;
case 21:B1();break;
case 22:B2();break;
case 23:B3();break;
case 31:R1();break;
case 32:R2();break;
case 33:R3();break;
case 41:L1();break;
case 42:L2();break;
case 43:L3();break;
case 51:U1();break;
case 52:U2();break;
case 53:U3();break;
case 61:D1();break;
case 62:D2();break;
case 63:D3();break;
default:break;
}
}
}
示例6: QBAR
/*reverse quad round*/
static inline void QBAR (u32 * block, u8 * Kr, u32 * Km) {
u32 I;
block[3] ^= F1(block[0], Kr[3], Km[3]);
block[0] ^= F3(block[1], Kr[2], Km[2]);
block[1] ^= F2(block[2], Kr[1], Km[1]);
block[2] ^= F1(block[3], Kr[0], Km[0]);
}
示例7: TEST
TEST(RecorderTest, ArgRecorderTest) {
TRACER_TRACE(&F2) f2;
auto f2a = tracer::RecordArgs(f2);
int a = 5;
F2(a);
for (int i = a; i >= 0; i--)
EXPECT_EQ(5 - i, f2a.Arg<0>(i));
}
示例8: cast5_decrypt
static void cast5_decrypt(void *ctx, u8 * outbuf, const u8 * inbuf)
{
struct cast5_ctx *c = (struct cast5_ctx *) ctx;
const __be32 *src = (const __be32 *)inbuf;
__be32 *dst = (__be32 *)outbuf;
u32 l, r, t;
u32 I;
u32 *Km;
u8 *Kr;
Km = c->Km;
Kr = c->Kr;
l = be32_to_cpu(src[0]);
r = be32_to_cpu(src[1]);
if (!(c->rr)) {
t = l; l = r; r = t ^ F1(r, Km[15], Kr[15]);
t = l; l = r; r = t ^ F3(r, Km[14], Kr[14]);
t = l; l = r; r = t ^ F2(r, Km[13], Kr[13]);
t = l; l = r; r = t ^ F1(r, Km[12], Kr[12]);
t = l; l = r; r = t ^ F3(r, Km[11], Kr[11]);
t = l; l = r; r = t ^ F2(r, Km[10], Kr[10]);
t = l; l = r; r = t ^ F1(r, Km[9], Kr[9]);
t = l; l = r; r = t ^ F3(r, Km[8], Kr[8]);
t = l; l = r; r = t ^ F2(r, Km[7], Kr[7]);
t = l; l = r; r = t ^ F1(r, Km[6], Kr[6]);
t = l; l = r; r = t ^ F3(r, Km[5], Kr[5]);
t = l; l = r; r = t ^ F2(r, Km[4], Kr[4]);
t = l; l = r; r = t ^ F1(r, Km[3], Kr[3]);
t = l; l = r; r = t ^ F3(r, Km[2], Kr[2]);
t = l; l = r; r = t ^ F2(r, Km[1], Kr[1]);
t = l; l = r; r = t ^ F1(r, Km[0], Kr[0]);
} else {
t = l; l = r; r = t ^ F3(r, Km[11], Kr[11]);
t = l; l = r; r = t ^ F2(r, Km[10], Kr[10]);
t = l; l = r; r = t ^ F1(r, Km[9], Kr[9]);
t = l; l = r; r = t ^ F3(r, Km[8], Kr[8]);
t = l; l = r; r = t ^ F2(r, Km[7], Kr[7]);
t = l; l = r; r = t ^ F1(r, Km[6], Kr[6]);
t = l; l = r; r = t ^ F3(r, Km[5], Kr[5]);
t = l; l = r; r = t ^ F2(r, Km[4], Kr[4]);
t = l; l = r; r = t ^ F1(r, Km[3], Kr[3]);
t = l; l = r; r = t ^ F3(r, Km[2], Kr[2]);
t = l; l = r; r = t ^ F2(r, Km[1], Kr[1]);
t = l; l = r; r = t ^ F1(r, Km[0], Kr[0]);
}
dst[0] = cpu_to_be32(r);
dst[1] = cpu_to_be32(l);
}
示例9: return
const char* ChannelSelector::getChannelName()
{
if (current_channel>CHANNEL_NONE && current_channel<CHANNEL_LAST) {
return (const char*)channel_names[(int)current_channel];
}
else {
return (const char*)F2("N/A");
}
}
示例10: main
int main()
{
auto a1 = F1();
auto a2 = F2();
auto a3 = F3();
auto a4 = F4();
auto a5 = F5();
return 0;
}
示例11: cast_decrypt
void
cast_decrypt(cast_key* key, u_int8_t* inblock, u_int8_t* outblock)
{
u_int32_t t, l, r;
/* Get inblock into l,r */
r = ((u_int32_t)inblock[0] << 24) | ((u_int32_t)inblock[1] << 16) |
((u_int32_t)inblock[2] << 8) | (u_int32_t)inblock[3];
l = ((u_int32_t)inblock[4] << 24) | ((u_int32_t)inblock[5] << 16) |
((u_int32_t)inblock[6] << 8) | (u_int32_t)inblock[7];
/* Do the work */
/* Only do full 16 rounds if key length > 80 bits */
if (key->rounds > 12) {
F1(r, l, 15);
F3(l, r, 14);
F2(r, l, 13);
F1(l, r, 12);
}
F3(r, l, 11);
F2(l, r, 10);
F1(r, l, 9);
F3(l, r, 8);
F2(r, l, 7);
F1(l, r, 6);
F3(r, l, 5);
F2(l, r, 4);
F1(r, l, 3);
F3(l, r, 2);
F2(r, l, 1);
F1(l, r, 0);
/* Put l,r into outblock */
outblock[0] = U8a(l);
outblock[1] = U8b(l);
outblock[2] = U8c(l);
outblock[3] = U8d(l);
outblock[4] = U8a(r);
outblock[5] = U8b(r);
outblock[6] = U8c(r);
outblock[7] = U8d(r);
/* Wipe clean */
t = l = r = 0;
}
示例12: q_deNot
static q_expr
q_deNot(
q_expr e)
{
q_expr r;
if (e == NULL) {
return NULL;
}
if (e->kind == T_FNC) {
switch (e->info.function->tag) {
case Q_EXPR_LIKE: r = e; break;
case Q_EXPR_EQ: e->info.function->tag = Q_EXPR_NE; r = e; break;
case Q_EXPR_NE: e->info.function->tag = Q_EXPR_EQ; r = e; break;
case Q_EXPR_LT: e->info.function->tag = Q_EXPR_GE; r = e; break;
case Q_EXPR_LE: e->info.function->tag = Q_EXPR_GT; r = e; break;
case Q_EXPR_GT: e->info.function->tag = Q_EXPR_LE; r = e; break;
case Q_EXPR_GE: e->info.function->tag = Q_EXPR_LT; r = e; break;
case Q_EXPR_NOT:
r = q_takePar(e,0);
q_dispose(e);
break;
case Q_EXPR_AND:
r = F2(Q_EXPR_OR,q_removeNots(q_takePar(e,0)),q_removeNots(q_takePar(e,1)));
q_dispose(e);
break;
case Q_EXPR_OR:
r = F2(Q_EXPR_AND,q_removeNots(q_takePar(e,0)),q_removeNots(q_takePar(e,1)));
q_dispose(e);
break;
default:
assert(FALSE);
r = e;
break;
}
} else {
r = e;
}
return r;
}
示例13: CAST5decrypt
void
CAST5decrypt(const PGPUInt8 *in, PGPUInt8 *out, const PGPUInt32 *xkey)
{
PGPUInt32 l, r, t;
r = (PGPUInt32) in[0]<<24 | (PGPUInt32) in[1]<<16 |
(PGPUInt32) in[2]<<8 | in[3];
l = (PGPUInt32) in[4]<<24 | (PGPUInt32) in[5]<<16 |
(PGPUInt32) in[6]<<8 | in[7];
t = F1(l, xkey, 15); r ^= G1(t);
t = F3(r, xkey, 14); l ^= G3(t);
t = F2(l, xkey, 13); r ^= G2(t);
t = F1(r, xkey, 12); l ^= G1(t);
// Start here if only doing 12 rounds
t = F3(l, xkey, 11); r ^= G3(t);
t = F2(r, xkey, 10); l ^= G2(t);
t = F1(l, xkey, 9); r ^= G1(t);
t = F3(r, xkey, 8); l ^= G3(t);
t = F2(l, xkey, 7); r ^= G2(t);
t = F1(r, xkey, 6); l ^= G1(t);
t = F3(l, xkey, 5); r ^= G3(t);
t = F2(r, xkey, 4); l ^= G2(t);
t = F1(l, xkey, 3); r ^= G1(t);
t = F3(r, xkey, 2); l ^= G3(t);
t = F2(l, xkey, 1); r ^= G2(t);
t = F1(r, xkey, 0); l ^= G1(t);
out[0] = (PGPUInt8) B0(l);
out[1] = (PGPUInt8) B1(l);
out[2] = (PGPUInt8) B2(l);
out[3] = (PGPUInt8) B3(l);
out[4] = (PGPUInt8) B0(r);
out[5] = (PGPUInt8) B1(r);
out[6] = (PGPUInt8) B2(r);
out[7] = (PGPUInt8) B3(r);
}
示例14: bf_e_block
static void bf_e_block(uint32_t *p_xl, uint32_t *p_xr)
{
uint32_t temp;
uint32_t xl = *p_xl;
uint32_t xr = *p_xr;
F1(0) F2(1) F1(2) F2(3) F1(4) F2(5) F1(6) F2(7)
F1(8) F2(9) F1(10) F2(11) F1(12) F2(13) F1(14) F2(15)
xl ^= pax[16];
xr ^= pax[17];
temp = xl;
xl = xr;
xr = temp;
*p_xl = xl;
*p_xr = xr;
}
示例15: Vector_Drive
void
Vector_Drive(vector V, double omega)
{
vector F1(-1.000,0.000), F2(0.500,-0.866), F3(0.866,0.500);
double omega1, omega2, omega3, b=0.090, r=0.020, h=0;
omega1 = ( F1*V + b*omega ) / r; // F1*V is overloaded dot product
omega2 = ( F2*V + b*omega ) / r;
omega3 = ( F3*V + b*omega ) / r;
// makes sure that given path is physically possible
if ( (omega1>6) || (omega2>6) || (omega3>6) || (omega1<-6) || (omega2<-6) || (omega3<-6) )
DisplayTxt("Vectors: ERROR!");
else
Drive(Vel_To_Value(omega1),Vel_To_Value(omega2),Vel_To_Value(omega3));
}