static void serpent_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); const u32 *k = ctx->expkey; const __le32 *s = (const __le32 *)src; __le32 *d = (__le32 *)dst; u32 r0, r1, r2, r3, r4; /* * Note: The conversions between u8* and u32* might cause trouble * on architectures with stricter alignment rules than x86 */ r0 = le32_to_cpu(s[0]); r1 = le32_to_cpu(s[1]); r2 = le32_to_cpu(s[2]); r3 = le32_to_cpu(s[3]); K(r0,r1,r2,r3,0); S0(r0,r1,r2,r3,r4); LK(r2,r1,r3,r0,r4,1); S1(r2,r1,r3,r0,r4); LK(r4,r3,r0,r2,r1,2); S2(r4,r3,r0,r2,r1); LK(r1,r3,r4,r2,r0,3); S3(r1,r3,r4,r2,r0); LK(r2,r0,r3,r1,r4,4); S4(r2,r0,r3,r1,r4); LK(r0,r3,r1,r4,r2,5); S5(r0,r3,r1,r4,r2); LK(r2,r0,r3,r4,r1,6); S6(r2,r0,r3,r4,r1); LK(r3,r1,r0,r4,r2,7); S7(r3,r1,r0,r4,r2); LK(r2,r0,r4,r3,r1,8); S0(r2,r0,r4,r3,r1); LK(r4,r0,r3,r2,r1,9); S1(r4,r0,r3,r2,r1); LK(r1,r3,r2,r4,r0,10); S2(r1,r3,r2,r4,r0); LK(r0,r3,r1,r4,r2,11); S3(r0,r3,r1,r4,r2); LK(r4,r2,r3,r0,r1,12); S4(r4,r2,r3,r0,r1); LK(r2,r3,r0,r1,r4,13); S5(r2,r3,r0,r1,r4); LK(r4,r2,r3,r1,r0,14); S6(r4,r2,r3,r1,r0); LK(r3,r0,r2,r1,r4,15); S7(r3,r0,r2,r1,r4); LK(r4,r2,r1,r3,r0,16); S0(r4,r2,r1,r3,r0); LK(r1,r2,r3,r4,r0,17); S1(r1,r2,r3,r4,r0); LK(r0,r3,r4,r1,r2,18); S2(r0,r3,r4,r1,r2); LK(r2,r3,r0,r1,r4,19); S3(r2,r3,r0,r1,r4); LK(r1,r4,r3,r2,r0,20); S4(r1,r4,r3,r2,r0); LK(r4,r3,r2,r0,r1,21); S5(r4,r3,r2,r0,r1); LK(r1,r4,r3,r0,r2,22); S6(r1,r4,r3,r0,r2); LK(r3,r2,r4,r0,r1,23); S7(r3,r2,r4,r0,r1); LK(r1,r4,r0,r3,r2,24); S0(r1,r4,r0,r3,r2); LK(r0,r4,r3,r1,r2,25); S1(r0,r4,r3,r1,r2); LK(r2,r3,r1,r0,r4,26); S2(r2,r3,r1,r0,r4); LK(r4,r3,r2,r0,r1,27); S3(r4,r3,r2,r0,r1); LK(r0,r1,r3,r4,r2,28); S4(r0,r1,r3,r4,r2); LK(r1,r3,r4,r2,r0,29); S5(r1,r3,r4,r2,r0); LK(r0,r1,r3,r2,r4,30); S6(r0,r1,r3,r2,r4); LK(r3,r4,r1,r2,r0,31); S7(r3,r4,r1,r2,r0); K(r0,r1,r2,r3,32); d[0] = cpu_to_le32(r0); d[1] = cpu_to_le32(r1); d[2] = cpu_to_le32(r2); d[3] = cpu_to_le32(r3); }
void _stdcall serpent256_encrypt(const unsigned char *in, unsigned char *out, serpent256_key *key) { u32 *k = key->expkey; u32 r0, r1, r2, r3, r4; r0 = p32(in)[0]; r1 = p32(in)[1]; r2 = p32(in)[2]; r3 = p32(in)[3]; K(r0,r1,r2,r3,0); S0(r0,r1,r2,r3,r4); LK(r2,r1,r3,r0,r4,1); S1(r2,r1,r3,r0,r4); LK(r4,r3,r0,r2,r1,2); S2(r4,r3,r0,r2,r1); LK(r1,r3,r4,r2,r0,3); S3(r1,r3,r4,r2,r0); LK(r2,r0,r3,r1,r4,4); S4(r2,r0,r3,r1,r4); LK(r0,r3,r1,r4,r2,5); S5(r0,r3,r1,r4,r2); LK(r2,r0,r3,r4,r1,6); S6(r2,r0,r3,r4,r1); LK(r3,r1,r0,r4,r2,7); S7(r3,r1,r0,r4,r2); LK(r2,r0,r4,r3,r1,8); S0(r2,r0,r4,r3,r1); LK(r4,r0,r3,r2,r1,9); S1(r4,r0,r3,r2,r1); LK(r1,r3,r2,r4,r0,10); S2(r1,r3,r2,r4,r0); LK(r0,r3,r1,r4,r2,11); S3(r0,r3,r1,r4,r2); LK(r4,r2,r3,r0,r1,12); S4(r4,r2,r3,r0,r1); LK(r2,r3,r0,r1,r4,13); S5(r2,r3,r0,r1,r4); LK(r4,r2,r3,r1,r0,14); S6(r4,r2,r3,r1,r0); LK(r3,r0,r2,r1,r4,15); S7(r3,r0,r2,r1,r4); LK(r4,r2,r1,r3,r0,16); S0(r4,r2,r1,r3,r0); LK(r1,r2,r3,r4,r0,17); S1(r1,r2,r3,r4,r0); LK(r0,r3,r4,r1,r2,18); S2(r0,r3,r4,r1,r2); LK(r2,r3,r0,r1,r4,19); S3(r2,r3,r0,r1,r4); LK(r1,r4,r3,r2,r0,20); S4(r1,r4,r3,r2,r0); LK(r4,r3,r2,r0,r1,21); S5(r4,r3,r2,r0,r1); LK(r1,r4,r3,r0,r2,22); S6(r1,r4,r3,r0,r2); LK(r3,r2,r4,r0,r1,23); S7(r3,r2,r4,r0,r1); LK(r1,r4,r0,r3,r2,24); S0(r1,r4,r0,r3,r2); LK(r0,r4,r3,r1,r2,25); S1(r0,r4,r3,r1,r2); LK(r2,r3,r1,r0,r4,26); S2(r2,r3,r1,r0,r4); LK(r4,r3,r2,r0,r1,27); S3(r4,r3,r2,r0,r1); LK(r0,r1,r3,r4,r2,28); S4(r0,r1,r3,r4,r2); LK(r1,r3,r4,r2,r0,29); S5(r1,r3,r4,r2,r0); LK(r0,r1,r3,r2,r4,30); S6(r0,r1,r3,r2,r4); LK(r3,r4,r1,r2,r0,31); S7(r3,r4,r1,r2,r0); K(r0,r1,r2,r3,32); p32(out)[0] = r0; p32(out)[1] = r1; p32(out)[2] = r2; p32(out)[3] = r3; }
inline void SpawnTask::OnTaskUpdate(const StateEntry& entry) { if(!IsTerminal(entry.m_state)) { return; } --m_taskCount; if(m_state == 1) { return S5(); } }
static void __serpent_setkey_sbox(u32 r0, u32 r1, u32 r2, u32 r3, u32 r4, u32 *k) { k += 100; S3(r3, r4, r0, r1, r2); store_and_load_keys(r1, r2, r4, r3, 28, 24); S4(r1, r2, r4, r3, r0); store_and_load_keys(r2, r4, r3, r0, 24, 20); S5(r2, r4, r3, r0, r1); store_and_load_keys(r1, r2, r4, r0, 20, 16); S6(r1, r2, r4, r0, r3); store_and_load_keys(r4, r3, r2, r0, 16, 12); S7(r4, r3, r2, r0, r1); store_and_load_keys(r1, r2, r0, r4, 12, 8); S0(r1, r2, r0, r4, r3); store_and_load_keys(r0, r2, r4, r1, 8, 4); S1(r0, r2, r4, r1, r3); store_and_load_keys(r3, r4, r1, r0, 4, 0); S2(r3, r4, r1, r0, r2); store_and_load_keys(r2, r4, r3, r0, 0, -4); S3(r2, r4, r3, r0, r1); store_and_load_keys(r0, r1, r4, r2, -4, -8); S4(r0, r1, r4, r2, r3); store_and_load_keys(r1, r4, r2, r3, -8, -12); S5(r1, r4, r2, r3, r0); store_and_load_keys(r0, r1, r4, r3, -12, -16); S6(r0, r1, r4, r3, r2); store_and_load_keys(r4, r2, r1, r3, -16, -20); S7(r4, r2, r1, r3, r0); store_and_load_keys(r0, r1, r3, r4, -20, -24); S0(r0, r1, r3, r4, r2); store_and_load_keys(r3, r1, r4, r0, -24, -28); k -= 50; S1(r3, r1, r4, r0, r2); store_and_load_keys(r2, r4, r0, r3, 22, 18); S2(r2, r4, r0, r3, r1); store_and_load_keys(r1, r4, r2, r3, 18, 14); S3(r1, r4, r2, r3, r0); store_and_load_keys(r3, r0, r4, r1, 14, 10); S4(r3, r0, r4, r1, r2); store_and_load_keys(r0, r4, r1, r2, 10, 6); S5(r0, r4, r1, r2, r3); store_and_load_keys(r3, r0, r4, r2, 6, 2); S6(r3, r0, r4, r2, r1); store_and_load_keys(r4, r1, r0, r2, 2, -2); S7(r4, r1, r0, r2, r3); store_and_load_keys(r3, r0, r2, r4, -2, -6); S0(r3, r0, r2, r4, r1); store_and_load_keys(r2, r0, r4, r3, -6, -10); S1(r2, r0, r4, r3, r1); store_and_load_keys(r1, r4, r3, r2, -10, -14); S2(r1, r4, r3, r2, r0); store_and_load_keys(r0, r4, r1, r2, -14, -18); S3(r0, r4, r1, r2, r3); store_and_load_keys(r2, r3, r4, r0, -18, -22); k -= 50; S4(r2, r3, r4, r0, r1); store_and_load_keys(r3, r4, r0, r1, 28, 24); S5(r3, r4, r0, r1, r2); store_and_load_keys(r2, r3, r4, r1, 24, 20); S6(r2, r3, r4, r1, r0); store_and_load_keys(r4, r0, r3, r1, 20, 16); S7(r4, r0, r3, r1, r2); store_and_load_keys(r2, r3, r1, r4, 16, 12); S0(r2, r3, r1, r4, r0); store_and_load_keys(r1, r3, r4, r2, 12, 8); S1(r1, r3, r4, r2, r0); store_and_load_keys(r0, r4, r2, r1, 8, 4); S2(r0, r4, r2, r1, r3); store_and_load_keys(r3, r4, r0, r1, 4, 0); S3(r3, r4, r0, r1, r2); storekeys(r1, r2, r4, r3, 0); }
void sw_base(long bM, long bN, short* seq_A, short* seq_B, int* A, int* B, int* c, int* Aout, int* Bout){ ///Parameter checking if (!((bM >= 2 && bN >= 2))) { printf("The value of parameters are not valid.\n"); exit(-1); } //Memory Allocation int mz1, mz2; int gap_penalty; int* _lin_Table = (int*)malloc(sizeof(int)*((bM) * (bN))); mallocCheck(_lin_Table, ((bM) * (bN)), int); int** Table = (int**)malloc(sizeof(int*)*(bM)); mallocCheck(Table, (bM), int*); for (mz1=0;mz1 < bM; mz1++) { Table[mz1] = &_lin_Table[(mz1*(bN))]; } #define S0(i0,i1,i2) gap_penalty = -(1) #define S1(i,j,i2) Table(j-i2,i2) = __max_int(0,__max_int((*c)+(similarity_function(seq_A(j-i2),seq_B(i2))),__max_int((A(j-i2))+(gap_penalty),(B(i2))+(gap_penalty)))) #define S2(i,j,i2) Table(j-i2,i2) = __max_int(0,__max_int((B(i2-1))+(similarity_function(seq_A(j-i2),seq_B(i2))),__max_int((Table(j-i2,i2-1))+(gap_penalty),(B(i2))+(gap_penalty)))) #define S3(i,j,i2) Table(j-i2,i2) = __max_int(0,__max_int((A(j-i2-1))+(similarity_function(seq_A(j-i2),seq_B(i2))),__max_int((A(j-i2))+(gap_penalty),(Table(j-i2-1,i2))+(gap_penalty)))) #define S4(i,j,i2) Table(j-i2,i2) = __max_int(0,__max_int((Table(j-i2-1,i2-1))+(similarity_function(seq_A(j-i2),seq_B(i2))),__max_int((Table(j-i2,i2-1))+(gap_penalty),(Table(j-i2-1,i2))+(gap_penalty)))) #define S5(i,i1,i2) Aout(i1-bM) = Table(i1-bM,bN-1) #define S6(i,i1,i2) Bout(i1-bN) = Table(bM-1,i1-bN) { //Domain //{i0,i1,i2|i2==0 && i1==0 && i0==0 && bM>=2 && bN>=2} //{i,j,i2|i2==0 && j==0 && i==1 && bM>=2 && bN>=2} //{i,j,i2|i2==j && i==1 && j>=1 && bM>=2 && bN>=2 && bN>=j+1} //{i,j,i2|i2==0 && i==1 && j>=1 && bM>=2 && bN>=2 && bM>=j+1} //{i,j,i2|i==1 && j>=i2+1 && i2>=1 && bM>=2 && bN>=2 && bN>=i2+1 && bM+i2>=j+1} //{i,i1,i2|i2==0 && i==1 && i1>=bM && 2bM>=i1+1 && bN>=2 && bM>=2} //{i,i1,i2|i2==0 && i==1 && bM>=2 && bN>=2 && i1>=bN && 2bN>=i1+1} int c2,c3; S0((0),(0),(0)); S1((1),(0),(0)); S3((1),(1),(0)); S2((1),(1),(1)); for(c2=2;c2 <= min(bM-1,bN-1);c2+=1) { S3((1),(c2),(0)); for(c3=1;c3 <= c2-1;c3+=1) { S4((1),(c2),(c3)); } S2((1),(c2),(c2)); } for(c2=bN;c2 <= min(bM-1,2*bN-1);c2+=1) { S3((1),(c2),(0)); S6((1),(c2),(0)); for(c3=1;c3 <= bN-1;c3+=1) { S4((1),(c2),(c3)); } } for(c2=2*bN;c2 <= bM-1;c2+=1) { S3((1),(c2),(0)); for(c3=1;c3 <= bN-1;c3+=1) { S4((1),(c2),(c3)); } } for(c2=bM;c2 <= min(2*bM-1,bN-1);c2+=1) { S5((1),(c2),(0)); for(c3=c2-bM+1;c3 <= c2-1;c3+=1) { S4((1),(c2),(c3)); } S2((1),(c2),(c2)); } for(c2=2*bM;c2 <= bN-1;c2+=1) { for(c3=c2-bM+1;c3 <= c2-1;c3+=1) { S4((1),(c2),(c3)); } S2((1),(c2),(c2)); } for(c2=max(bM,bN);c2 <= min(2*bM-1,min(2*bN-1,bM+bN-2));c2+=1) { S5((1),(c2),(0)); S6((1),(c2),(0)); for(c3=c2-bM+1;c3 <= bN-1;c3+=1) { S4((1),(c2),(c3)); } } for(c2=max(bM,2*bN);c2 <= bM+bN-2;c2+=1) { S5((1),(c2),(0)); for(c3=c2-bM+1;c3 <= bN-1;c3+=1) { S4((1),(c2),(c3)); } } if ((bM == bN)) { { S5((1),(2*bM-1),(0)); S6((1),(2*bM-1),(0)); } } for(c2=max(2*bN,bM+bN-1);c2 <= 2*bM-1;c2+=1) { S5((1),(c2),(0)); } for(c2=max(2*bM,bN);c2 <= bM+bN-2;c2+=1) { S6((1),(c2),(0)); for(c3=c2-bM+1;c3 <= bN-1;c3+=1) { S4((1),(c2),(c3)); } } for(c2=max(2*bM,bM+bN-1);c2 <= 2*bN-1;c2+=1) { S6((1),(c2),(0)); } } #undef S0 #undef S1 #undef S2 #undef S3 #undef S4 #undef S5 #undef S6 //Memory Free free(_lin_Table); free(Table); }
void _stdcall serpent256_set_key(const unsigned char *key, serpent256_key *skey) { u32 *k = skey->expkey; u32 r0,r1,r2,r3,r4; /* Copy key, add padding */ memcpy(k, key, SERPENT_KEY_SIZE); /* Expand key using polynomial */ r0 = k[3]; r1 = k[4]; r2 = k[5]; r3 = k[6]; r4 = k[7]; keyiter(k[0],r0,r4,r2,0,0); keyiter(k[1],r1,r0,r3,1,1); keyiter(k[2],r2,r1,r4,2,2); keyiter(k[3],r3,r2,r0,3,3); keyiter(k[4],r4,r3,r1,4,4); keyiter(k[5],r0,r4,r2,5,5); keyiter(k[6],r1,r0,r3,6,6); keyiter(k[7],r2,r1,r4,7,7); keyiter(k[ 0],r3,r2,r0, 8, 8); keyiter(k[ 1],r4,r3,r1, 9, 9); keyiter(k[ 2],r0,r4,r2, 10, 10); keyiter(k[ 3],r1,r0,r3, 11, 11); keyiter(k[ 4],r2,r1,r4, 12, 12); keyiter(k[ 5],r3,r2,r0, 13, 13); keyiter(k[ 6],r4,r3,r1, 14, 14); keyiter(k[ 7],r0,r4,r2, 15, 15); keyiter(k[ 8],r1,r0,r3, 16, 16); keyiter(k[ 9],r2,r1,r4, 17, 17); keyiter(k[ 10],r3,r2,r0, 18, 18); keyiter(k[ 11],r4,r3,r1, 19, 19); keyiter(k[ 12],r0,r4,r2, 20, 20); keyiter(k[ 13],r1,r0,r3, 21, 21); keyiter(k[ 14],r2,r1,r4, 22, 22); keyiter(k[ 15],r3,r2,r0, 23, 23); keyiter(k[ 16],r4,r3,r1, 24, 24); keyiter(k[ 17],r0,r4,r2, 25, 25); keyiter(k[ 18],r1,r0,r3, 26, 26); keyiter(k[ 19],r2,r1,r4, 27, 27); keyiter(k[ 20],r3,r2,r0, 28, 28); keyiter(k[ 21],r4,r3,r1, 29, 29); keyiter(k[ 22],r0,r4,r2, 30, 30); keyiter(k[ 23],r1,r0,r3, 31, 31); k += 50; keyiter(k[-26],r2,r1,r4, 32,-18); keyiter(k[-25],r3,r2,r0, 33,-17); keyiter(k[-24],r4,r3,r1, 34,-16); keyiter(k[-23],r0,r4,r2, 35,-15); keyiter(k[-22],r1,r0,r3, 36,-14); keyiter(k[-21],r2,r1,r4, 37,-13); keyiter(k[-20],r3,r2,r0, 38,-12); keyiter(k[-19],r4,r3,r1, 39,-11); keyiter(k[-18],r0,r4,r2, 40,-10); keyiter(k[-17],r1,r0,r3, 41, -9); keyiter(k[-16],r2,r1,r4, 42, -8); keyiter(k[-15],r3,r2,r0, 43, -7); keyiter(k[-14],r4,r3,r1, 44, -6); keyiter(k[-13],r0,r4,r2, 45, -5); keyiter(k[-12],r1,r0,r3, 46, -4); keyiter(k[-11],r2,r1,r4, 47, -3); keyiter(k[-10],r3,r2,r0, 48, -2); keyiter(k[ -9],r4,r3,r1, 49, -1); keyiter(k[ -8],r0,r4,r2, 50, 0); keyiter(k[ -7],r1,r0,r3, 51, 1); keyiter(k[ -6],r2,r1,r4, 52, 2); keyiter(k[ -5],r3,r2,r0, 53, 3); keyiter(k[ -4],r4,r3,r1, 54, 4); keyiter(k[ -3],r0,r4,r2, 55, 5); keyiter(k[ -2],r1,r0,r3, 56, 6); keyiter(k[ -1],r2,r1,r4, 57, 7); keyiter(k[ 0],r3,r2,r0, 58, 8); keyiter(k[ 1],r4,r3,r1, 59, 9); keyiter(k[ 2],r0,r4,r2, 60, 10); keyiter(k[ 3],r1,r0,r3, 61, 11); keyiter(k[ 4],r2,r1,r4, 62, 12); keyiter(k[ 5],r3,r2,r0, 63, 13); keyiter(k[ 6],r4,r3,r1, 64, 14); keyiter(k[ 7],r0,r4,r2, 65, 15); keyiter(k[ 8],r1,r0,r3, 66, 16); keyiter(k[ 9],r2,r1,r4, 67, 17); keyiter(k[ 10],r3,r2,r0, 68, 18); keyiter(k[ 11],r4,r3,r1, 69, 19); keyiter(k[ 12],r0,r4,r2, 70, 20); keyiter(k[ 13],r1,r0,r3, 71, 21); keyiter(k[ 14],r2,r1,r4, 72, 22); keyiter(k[ 15],r3,r2,r0, 73, 23); keyiter(k[ 16],r4,r3,r1, 74, 24); keyiter(k[ 17],r0,r4,r2, 75, 25); keyiter(k[ 18],r1,r0,r3, 76, 26); keyiter(k[ 19],r2,r1,r4, 77, 27); keyiter(k[ 20],r3,r2,r0, 78, 28); keyiter(k[ 21],r4,r3,r1, 79, 29); keyiter(k[ 22],r0,r4,r2, 80, 30); keyiter(k[ 23],r1,r0,r3, 81, 31); k += 50; keyiter(k[-26],r2,r1,r4, 82,-18); keyiter(k[-25],r3,r2,r0, 83,-17); keyiter(k[-24],r4,r3,r1, 84,-16); keyiter(k[-23],r0,r4,r2, 85,-15); keyiter(k[-22],r1,r0,r3, 86,-14); keyiter(k[-21],r2,r1,r4, 87,-13); keyiter(k[-20],r3,r2,r0, 88,-12); keyiter(k[-19],r4,r3,r1, 89,-11); keyiter(k[-18],r0,r4,r2, 90,-10); keyiter(k[-17],r1,r0,r3, 91, -9); keyiter(k[-16],r2,r1,r4, 92, -8); keyiter(k[-15],r3,r2,r0, 93, -7); keyiter(k[-14],r4,r3,r1, 94, -6); keyiter(k[-13],r0,r4,r2, 95, -5); keyiter(k[-12],r1,r0,r3, 96, -4); keyiter(k[-11],r2,r1,r4, 97, -3); keyiter(k[-10],r3,r2,r0, 98, -2); keyiter(k[ -9],r4,r3,r1, 99, -1); keyiter(k[ -8],r0,r4,r2,100, 0); keyiter(k[ -7],r1,r0,r3,101, 1); keyiter(k[ -6],r2,r1,r4,102, 2); keyiter(k[ -5],r3,r2,r0,103, 3); keyiter(k[ -4],r4,r3,r1,104, 4); keyiter(k[ -3],r0,r4,r2,105, 5); keyiter(k[ -2],r1,r0,r3,106, 6); keyiter(k[ -1],r2,r1,r4,107, 7); keyiter(k[ 0],r3,r2,r0,108, 8); keyiter(k[ 1],r4,r3,r1,109, 9); keyiter(k[ 2],r0,r4,r2,110, 10); keyiter(k[ 3],r1,r0,r3,111, 11); keyiter(k[ 4],r2,r1,r4,112, 12); keyiter(k[ 5],r3,r2,r0,113, 13); keyiter(k[ 6],r4,r3,r1,114, 14); keyiter(k[ 7],r0,r4,r2,115, 15); keyiter(k[ 8],r1,r0,r3,116, 16); keyiter(k[ 9],r2,r1,r4,117, 17); keyiter(k[ 10],r3,r2,r0,118, 18); keyiter(k[ 11],r4,r3,r1,119, 19); keyiter(k[ 12],r0,r4,r2,120, 20); keyiter(k[ 13],r1,r0,r3,121, 21); keyiter(k[ 14],r2,r1,r4,122, 22); keyiter(k[ 15],r3,r2,r0,123, 23); keyiter(k[ 16],r4,r3,r1,124, 24); keyiter(k[ 17],r0,r4,r2,125, 25); keyiter(k[ 18],r1,r0,r3,126, 26); keyiter(k[ 19],r2,r1,r4,127, 27); keyiter(k[ 20],r3,r2,r0,128, 28); keyiter(k[ 21],r4,r3,r1,129, 29); keyiter(k[ 22],r0,r4,r2,130, 30); keyiter(k[ 23],r1,r0,r3,131, 31); /* Apply S-boxes */ S3(r3,r4,r0,r1,r2); storekeys(r1,r2,r4,r3, 28); loadkeys(r1,r2,r4,r3, 24); S4(r1,r2,r4,r3,r0); storekeys(r2,r4,r3,r0, 24); loadkeys(r2,r4,r3,r0, 20); S5(r2,r4,r3,r0,r1); storekeys(r1,r2,r4,r0, 20); loadkeys(r1,r2,r4,r0, 16); S6(r1,r2,r4,r0,r3); storekeys(r4,r3,r2,r0, 16); loadkeys(r4,r3,r2,r0, 12); S7(r4,r3,r2,r0,r1); storekeys(r1,r2,r0,r4, 12); loadkeys(r1,r2,r0,r4, 8); S0(r1,r2,r0,r4,r3); storekeys(r0,r2,r4,r1, 8); loadkeys(r0,r2,r4,r1, 4); S1(r0,r2,r4,r1,r3); storekeys(r3,r4,r1,r0, 4); loadkeys(r3,r4,r1,r0, 0); S2(r3,r4,r1,r0,r2); storekeys(r2,r4,r3,r0, 0); loadkeys(r2,r4,r3,r0, -4); S3(r2,r4,r3,r0,r1); storekeys(r0,r1,r4,r2, -4); loadkeys(r0,r1,r4,r2, -8); S4(r0,r1,r4,r2,r3); storekeys(r1,r4,r2,r3, -8); loadkeys(r1,r4,r2,r3,-12); S5(r1,r4,r2,r3,r0); storekeys(r0,r1,r4,r3,-12); loadkeys(r0,r1,r4,r3,-16); S6(r0,r1,r4,r3,r2); storekeys(r4,r2,r1,r3,-16); loadkeys(r4,r2,r1,r3,-20); S7(r4,r2,r1,r3,r0); storekeys(r0,r1,r3,r4,-20); loadkeys(r0,r1,r3,r4,-24); S0(r0,r1,r3,r4,r2); storekeys(r3,r1,r4,r0,-24); loadkeys(r3,r1,r4,r0,-28); k -= 50; S1(r3,r1,r4,r0,r2); storekeys(r2,r4,r0,r3, 22); loadkeys(r2,r4,r0,r3, 18); S2(r2,r4,r0,r3,r1); storekeys(r1,r4,r2,r3, 18); loadkeys(r1,r4,r2,r3, 14); S3(r1,r4,r2,r3,r0); storekeys(r3,r0,r4,r1, 14); loadkeys(r3,r0,r4,r1, 10); S4(r3,r0,r4,r1,r2); storekeys(r0,r4,r1,r2, 10); loadkeys(r0,r4,r1,r2, 6); S5(r0,r4,r1,r2,r3); storekeys(r3,r0,r4,r2, 6); loadkeys(r3,r0,r4,r2, 2); S6(r3,r0,r4,r2,r1); storekeys(r4,r1,r0,r2, 2); loadkeys(r4,r1,r0,r2, -2); S7(r4,r1,r0,r2,r3); storekeys(r3,r0,r2,r4, -2); loadkeys(r3,r0,r2,r4, -6); S0(r3,r0,r2,r4,r1); storekeys(r2,r0,r4,r3, -6); loadkeys(r2,r0,r4,r3,-10); S1(r2,r0,r4,r3,r1); storekeys(r1,r4,r3,r2,-10); loadkeys(r1,r4,r3,r2,-14); S2(r1,r4,r3,r2,r0); storekeys(r0,r4,r1,r2,-14); loadkeys(r0,r4,r1,r2,-18); S3(r0,r4,r1,r2,r3); storekeys(r2,r3,r4,r0,-18); loadkeys(r2,r3,r4,r0,-22); k -= 50; S4(r2,r3,r4,r0,r1); storekeys(r3,r4,r0,r1, 28); loadkeys(r3,r4,r0,r1, 24); S5(r3,r4,r0,r1,r2); storekeys(r2,r3,r4,r1, 24); loadkeys(r2,r3,r4,r1, 20); S6(r2,r3,r4,r1,r0); storekeys(r4,r0,r3,r1, 20); loadkeys(r4,r0,r3,r1, 16); S7(r4,r0,r3,r1,r2); storekeys(r2,r3,r1,r4, 16); loadkeys(r2,r3,r1,r4, 12); S0(r2,r3,r1,r4,r0); storekeys(r1,r3,r4,r2, 12); loadkeys(r1,r3,r4,r2, 8); S1(r1,r3,r4,r2,r0); storekeys(r0,r4,r2,r1, 8); loadkeys(r0,r4,r2,r1, 4); S2(r0,r4,r2,r1,r3); storekeys(r3,r4,r0,r1, 4); loadkeys(r3,r4,r0,r1, 0); S3(r3,r4,r0,r1,r2); storekeys(r1,r2,r4,r3, 0); }
int __serpent_setkey(struct serpent_ctx *ctx, const u8 *key, unsigned int keylen) { u32 *k = ctx->expkey; u8 *k8 = (u8 *)k; u32 r0, r1, r2, r3, r4; int i; /* Copy key, add padding */ for (i = 0; i < keylen; ++i) k8[i] = key[i]; if (i < SERPENT_MAX_KEY_SIZE) k8[i++] = 1; while (i < SERPENT_MAX_KEY_SIZE) k8[i++] = 0; /* Expand key using polynomial */ r0 = le32_to_cpu(k[3]); r1 = le32_to_cpu(k[4]); r2 = le32_to_cpu(k[5]); r3 = le32_to_cpu(k[6]); r4 = le32_to_cpu(k[7]); keyiter(le32_to_cpu(k[0]), r0, r4, r2, 0, 0); keyiter(le32_to_cpu(k[1]), r1, r0, r3, 1, 1); keyiter(le32_to_cpu(k[2]), r2, r1, r4, 2, 2); keyiter(le32_to_cpu(k[3]), r3, r2, r0, 3, 3); keyiter(le32_to_cpu(k[4]), r4, r3, r1, 4, 4); keyiter(le32_to_cpu(k[5]), r0, r4, r2, 5, 5); keyiter(le32_to_cpu(k[6]), r1, r0, r3, 6, 6); keyiter(le32_to_cpu(k[7]), r2, r1, r4, 7, 7); keyiter(k[0], r3, r2, r0, 8, 8); keyiter(k[1], r4, r3, r1, 9, 9); keyiter(k[2], r0, r4, r2, 10, 10); keyiter(k[3], r1, r0, r3, 11, 11); keyiter(k[4], r2, r1, r4, 12, 12); keyiter(k[5], r3, r2, r0, 13, 13); keyiter(k[6], r4, r3, r1, 14, 14); keyiter(k[7], r0, r4, r2, 15, 15); keyiter(k[8], r1, r0, r3, 16, 16); keyiter(k[9], r2, r1, r4, 17, 17); keyiter(k[10], r3, r2, r0, 18, 18); keyiter(k[11], r4, r3, r1, 19, 19); keyiter(k[12], r0, r4, r2, 20, 20); keyiter(k[13], r1, r0, r3, 21, 21); keyiter(k[14], r2, r1, r4, 22, 22); keyiter(k[15], r3, r2, r0, 23, 23); keyiter(k[16], r4, r3, r1, 24, 24); keyiter(k[17], r0, r4, r2, 25, 25); keyiter(k[18], r1, r0, r3, 26, 26); keyiter(k[19], r2, r1, r4, 27, 27); keyiter(k[20], r3, r2, r0, 28, 28); keyiter(k[21], r4, r3, r1, 29, 29); keyiter(k[22], r0, r4, r2, 30, 30); keyiter(k[23], r1, r0, r3, 31, 31); k += 50; keyiter(k[-26], r2, r1, r4, 32, -18); keyiter(k[-25], r3, r2, r0, 33, -17); keyiter(k[-24], r4, r3, r1, 34, -16); keyiter(k[-23], r0, r4, r2, 35, -15); keyiter(k[-22], r1, r0, r3, 36, -14); keyiter(k[-21], r2, r1, r4, 37, -13); keyiter(k[-20], r3, r2, r0, 38, -12); keyiter(k[-19], r4, r3, r1, 39, -11); keyiter(k[-18], r0, r4, r2, 40, -10); keyiter(k[-17], r1, r0, r3, 41, -9); keyiter(k[-16], r2, r1, r4, 42, -8); keyiter(k[-15], r3, r2, r0, 43, -7); keyiter(k[-14], r4, r3, r1, 44, -6); keyiter(k[-13], r0, r4, r2, 45, -5); keyiter(k[-12], r1, r0, r3, 46, -4); keyiter(k[-11], r2, r1, r4, 47, -3); keyiter(k[-10], r3, r2, r0, 48, -2); keyiter(k[-9], r4, r3, r1, 49, -1); keyiter(k[-8], r0, r4, r2, 50, 0); keyiter(k[-7], r1, r0, r3, 51, 1); keyiter(k[-6], r2, r1, r4, 52, 2); keyiter(k[-5], r3, r2, r0, 53, 3); keyiter(k[-4], r4, r3, r1, 54, 4); keyiter(k[-3], r0, r4, r2, 55, 5); keyiter(k[-2], r1, r0, r3, 56, 6); keyiter(k[-1], r2, r1, r4, 57, 7); keyiter(k[0], r3, r2, r0, 58, 8); keyiter(k[1], r4, r3, r1, 59, 9); keyiter(k[2], r0, r4, r2, 60, 10); keyiter(k[3], r1, r0, r3, 61, 11); keyiter(k[4], r2, r1, r4, 62, 12); keyiter(k[5], r3, r2, r0, 63, 13); keyiter(k[6], r4, r3, r1, 64, 14); keyiter(k[7], r0, r4, r2, 65, 15); keyiter(k[8], r1, r0, r3, 66, 16); keyiter(k[9], r2, r1, r4, 67, 17); keyiter(k[10], r3, r2, r0, 68, 18); keyiter(k[11], r4, r3, r1, 69, 19); keyiter(k[12], r0, r4, r2, 70, 20); keyiter(k[13], r1, r0, r3, 71, 21); keyiter(k[14], r2, r1, r4, 72, 22); keyiter(k[15], r3, r2, r0, 73, 23); keyiter(k[16], r4, r3, r1, 74, 24); keyiter(k[17], r0, r4, r2, 75, 25); keyiter(k[18], r1, r0, r3, 76, 26); keyiter(k[19], r2, r1, r4, 77, 27); keyiter(k[20], r3, r2, r0, 78, 28); keyiter(k[21], r4, r3, r1, 79, 29); keyiter(k[22], r0, r4, r2, 80, 30); keyiter(k[23], r1, r0, r3, 81, 31); k += 50; keyiter(k[-26], r2, r1, r4, 82, -18); keyiter(k[-25], r3, r2, r0, 83, -17); keyiter(k[-24], r4, r3, r1, 84, -16); keyiter(k[-23], r0, r4, r2, 85, -15); keyiter(k[-22], r1, r0, r3, 86, -14); keyiter(k[-21], r2, r1, r4, 87, -13); keyiter(k[-20], r3, r2, r0, 88, -12); keyiter(k[-19], r4, r3, r1, 89, -11); keyiter(k[-18], r0, r4, r2, 90, -10); keyiter(k[-17], r1, r0, r3, 91, -9); keyiter(k[-16], r2, r1, r4, 92, -8); keyiter(k[-15], r3, r2, r0, 93, -7); keyiter(k[-14], r4, r3, r1, 94, -6); keyiter(k[-13], r0, r4, r2, 95, -5); keyiter(k[-12], r1, r0, r3, 96, -4); keyiter(k[-11], r2, r1, r4, 97, -3); keyiter(k[-10], r3, r2, r0, 98, -2); keyiter(k[-9], r4, r3, r1, 99, -1); keyiter(k[-8], r0, r4, r2, 100, 0); keyiter(k[-7], r1, r0, r3, 101, 1); keyiter(k[-6], r2, r1, r4, 102, 2); keyiter(k[-5], r3, r2, r0, 103, 3); keyiter(k[-4], r4, r3, r1, 104, 4); keyiter(k[-3], r0, r4, r2, 105, 5); keyiter(k[-2], r1, r0, r3, 106, 6); keyiter(k[-1], r2, r1, r4, 107, 7); keyiter(k[0], r3, r2, r0, 108, 8); keyiter(k[1], r4, r3, r1, 109, 9); keyiter(k[2], r0, r4, r2, 110, 10); keyiter(k[3], r1, r0, r3, 111, 11); keyiter(k[4], r2, r1, r4, 112, 12); keyiter(k[5], r3, r2, r0, 113, 13); keyiter(k[6], r4, r3, r1, 114, 14); keyiter(k[7], r0, r4, r2, 115, 15); keyiter(k[8], r1, r0, r3, 116, 16); keyiter(k[9], r2, r1, r4, 117, 17); keyiter(k[10], r3, r2, r0, 118, 18); keyiter(k[11], r4, r3, r1, 119, 19); keyiter(k[12], r0, r4, r2, 120, 20); keyiter(k[13], r1, r0, r3, 121, 21); keyiter(k[14], r2, r1, r4, 122, 22); keyiter(k[15], r3, r2, r0, 123, 23); keyiter(k[16], r4, r3, r1, 124, 24); keyiter(k[17], r0, r4, r2, 125, 25); keyiter(k[18], r1, r0, r3, 126, 26); keyiter(k[19], r2, r1, r4, 127, 27); keyiter(k[20], r3, r2, r0, 128, 28); keyiter(k[21], r4, r3, r1, 129, 29); keyiter(k[22], r0, r4, r2, 130, 30); keyiter(k[23], r1, r0, r3, 131, 31); /* Apply S-boxes */ S3(r3, r4, r0, r1, r2); store_and_load_keys(r1, r2, r4, r3, 28, 24); S4(r1, r2, r4, r3, r0); store_and_load_keys(r2, r4, r3, r0, 24, 20); S5(r2, r4, r3, r0, r1); store_and_load_keys(r1, r2, r4, r0, 20, 16); S6(r1, r2, r4, r0, r3); store_and_load_keys(r4, r3, r2, r0, 16, 12); S7(r4, r3, r2, r0, r1); store_and_load_keys(r1, r2, r0, r4, 12, 8); S0(r1, r2, r0, r4, r3); store_and_load_keys(r0, r2, r4, r1, 8, 4); S1(r0, r2, r4, r1, r3); store_and_load_keys(r3, r4, r1, r0, 4, 0); S2(r3, r4, r1, r0, r2); store_and_load_keys(r2, r4, r3, r0, 0, -4); S3(r2, r4, r3, r0, r1); store_and_load_keys(r0, r1, r4, r2, -4, -8); S4(r0, r1, r4, r2, r3); store_and_load_keys(r1, r4, r2, r3, -8, -12); S5(r1, r4, r2, r3, r0); store_and_load_keys(r0, r1, r4, r3, -12, -16); S6(r0, r1, r4, r3, r2); store_and_load_keys(r4, r2, r1, r3, -16, -20); S7(r4, r2, r1, r3, r0); store_and_load_keys(r0, r1, r3, r4, -20, -24); S0(r0, r1, r3, r4, r2); store_and_load_keys(r3, r1, r4, r0, -24, -28); k -= 50; S1(r3, r1, r4, r0, r2); store_and_load_keys(r2, r4, r0, r3, 22, 18); S2(r2, r4, r0, r3, r1); store_and_load_keys(r1, r4, r2, r3, 18, 14); S3(r1, r4, r2, r3, r0); store_and_load_keys(r3, r0, r4, r1, 14, 10); S4(r3, r0, r4, r1, r2); store_and_load_keys(r0, r4, r1, r2, 10, 6); S5(r0, r4, r1, r2, r3); store_and_load_keys(r3, r0, r4, r2, 6, 2); S6(r3, r0, r4, r2, r1); store_and_load_keys(r4, r1, r0, r2, 2, -2); S7(r4, r1, r0, r2, r3); store_and_load_keys(r3, r0, r2, r4, -2, -6); S0(r3, r0, r2, r4, r1); store_and_load_keys(r2, r0, r4, r3, -6, -10); S1(r2, r0, r4, r3, r1); store_and_load_keys(r1, r4, r3, r2, -10, -14); S2(r1, r4, r3, r2, r0); store_and_load_keys(r0, r4, r1, r2, -14, -18); S3(r0, r4, r1, r2, r3); store_and_load_keys(r2, r3, r4, r0, -18, -22); k -= 50; S4(r2, r3, r4, r0, r1); store_and_load_keys(r3, r4, r0, r1, 28, 24); S5(r3, r4, r0, r1, r2); store_and_load_keys(r2, r3, r4, r1, 24, 20); S6(r2, r3, r4, r1, r0); store_and_load_keys(r4, r0, r3, r1, 20, 16); S7(r4, r0, r3, r1, r2); store_and_load_keys(r2, r3, r1, r4, 16, 12); S0(r2, r3, r1, r4, r0); store_and_load_keys(r1, r3, r4, r2, 12, 8); S1(r1, r3, r4, r2, r0); store_and_load_keys(r0, r4, r2, r1, 8, 4); S2(r0, r4, r2, r1, r3); store_and_load_keys(r3, r4, r0, r1, 4, 0); S3(r3, r4, r0, r1, r2); storekeys(r1, r2, r4, r3, 0); return 0; }
// If a function is explicitly defaulted on its first declaration // -- it is implicitly considered to be constexpr if the implicit declaration // would be struct S3 { S3() = default; // expected-note {{here}} S3(const S3&) = default; S3(S3&&) = default; constexpr S3(int n) : n(n) {} int n; }; constexpr S3 s3a = S3(0); constexpr S3 s3b = s3a; constexpr S3 s3c = S3(); // expected-error {{constant expression}} expected-note {{non-constexpr constructor}} struct S4 { S4() = default; S4(const S4&) = default; // expected-note {{here}} S4(S4&&) = default; // expected-note {{here}} NoCopyMove ncm; }; constexpr S4 s4a; // ok constexpr S4 s4b = S4(); // expected-error {{constant expression}} expected-note {{non-constexpr constructor}} constexpr S4 s4c = s4a; // expected-error {{constant expression}} expected-note {{non-constexpr constructor}} struct S5 { constexpr S5(); int n = 1, m = n + 3; }; constexpr S5::S5() = default; static_assert(S5().m == 4, "");
void test(int M, int N) { /* Scattering iterators. */ int c2, c4, c6; /* Original iterators. */ int i, j, k; if ((M <= -1) && (N >= 1)) { S1(0) ; } if ((M >= 0) && (N >= 1)) { S1(0) ; } if ((M >= 1) && (N >= 2)) { for (c4=0;c4<=M-1;c4++) { S2(0,c4) ; } S3(0) ; for (c4=0;c4<=M-1;c4++) { S4(0,c4) ; } S10(0) ; S1(1) ; S5(0) ; } if ((M <= 0) && (N >= 2)) { S3(0) ; S10(0) ; S1(1) ; S5(0) ; } if ((M >= 1) && (N == 1)) { for (c4=0;c4<=M-1;c4++) { S2(0,c4) ; } S3(0) ; for (c4=0;c4<=M-1;c4++) { S4(0,c4) ; } S10(0) ; S5(0) ; } if ((M <= 0) && (N == 1)) { S3(0) ; S10(0) ; S5(0) ; } for (c2=2;c2<=min(N-1,M);c2++) { for (c4=c2-1;c4<=N-1;c4++) { i = c2-2 ; S6(c2-2,c4) ; for (c6=c2-2;c6<=M-1;c6++) { i = c2-2 ; S7(c2-2,c4,c6) ; } i = c2-2 ; S8(c2-2,c4) ; for (c6=c2-2;c6<=M-1;c6++) { i = c2-2 ; S9(c2-2,c4,c6) ; } } for (c4=c2-1;c4<=M-1;c4++) { i = c2-1 ; S2(c2-1,c4) ; } i = c2-1 ; S3(c2-1) ; for (c4=c2-1;c4<=M-1;c4++) { i = c2-1 ; S4(c2-1,c4) ; } i = c2-1 ; S10(c2-1) ; S1(c2) ; i = c2-1 ; S5(c2-1) ; } if ((M >= 1) && (M <= N-2)) { c2 = M+1 ; for (c4=M;c4<=N-1;c4++) { i = M-1 ; S6(M-1,c4) ; c6 = M-1 ; i = M-1 ; k = M-1 ; S7(M-1,c4,M-1) ; i = M-1 ; S8(M-1,c4) ; c6 = M-1 ; i = M-1 ; k = M-1 ; S9(M-1,c4,M-1) ; } S3(M) ; S10(M) ; i = M+1 ; S1(M+1) ; S5(M) ; } if ((M >= N) && (N >= 2)) { c4 = N-1 ; i = N-2 ; j = N-1 ; S6(N-2,N-1) ; for (c6=N-2;c6<=M-1;c6++) { i = N-2 ; j = N-1 ; S7(N-2,N-1,c6) ; } i = N-2 ; j = N-1 ; S8(N-2,N-1) ; for (c6=N-2;c6<=M-1;c6++) { i = N-2 ; j = N-1 ; S9(N-2,N-1,c6) ; } for (c4=N-1;c4<=M-1;c4++) { i = N-1 ; S2(N-1,c4) ; } i = N-1 ; S3(N-1) ; for (c4=N-1;c4<=M-1;c4++) { i = N-1 ; S4(N-1,c4) ; } i = N-1 ; S10(N-1) ; i = N-1 ; S5(N-1) ; } if ((M == N-1) && (N >= 2)) { c4 = N-1 ; i = N-2 ; j = N-1 ; S6(N-2,N-1) ; c6 = N-2 ; i = N-2 ; j = N-1 ; k = N-2 ; S7(N-2,N-1,N-2) ; i = N-2 ; j = N-1 ; S8(N-2,N-1) ; c6 = N-2 ; i = N-2 ; j = N-1 ; k = N-2 ; S9(N-2,N-1,N-2) ; i = N-1 ; S3(N-1) ; i = N-1 ; S10(N-1) ; i = N-1 ; S5(N-1) ; } for (c2=max(M+2,2);c2<=N-1;c2++) { for (c4=c2-1;c4<=N-1;c4++) { i = c2-2 ; S6(c2-2,c4) ; i = c2-2 ; S8(c2-2,c4) ; } i = c2-1 ; S3(c2-1) ; i = c2-1 ; S10(c2-1) ; S1(c2) ; i = c2-1 ; S5(c2-1) ; } if ((M <= N-2) && (N >= 2)) { c4 = N-1 ; i = N-2 ; j = N-1 ; S6(N-2,N-1) ; i = N-2 ; j = N-1 ; S8(N-2,N-1) ; i = N-1 ; S3(N-1) ; i = N-1 ; S10(N-1) ; i = N-1 ; S5(N-1) ; } }
void sha1_core(const uint32_t M[16], uint32_t hash_value[5]) { uint32_t H0; uint32_t H1; uint32_t H2; uint32_t H3; uint32_t H4; uint32_t W[80]; uint32_t A, B, C, D, E, TEMP; int t; /* copy hash_value into H0, H1, H2, H3, H4 */ H0 = hash_value[0]; H1 = hash_value[1]; H2 = hash_value[2]; H3 = hash_value[3]; H4 = hash_value[4]; /* copy/xor message into array */ W[0] = bswap_32(M[0]); W[1] = bswap_32(M[1]); W[2] = bswap_32(M[2]); W[3] = bswap_32(M[3]); W[4] = bswap_32(M[4]); W[5] = bswap_32(M[5]); W[6] = bswap_32(M[6]); W[7] = bswap_32(M[7]); W[8] = bswap_32(M[8]); W[9] = bswap_32(M[9]); W[10] = bswap_32(M[10]); W[11] = bswap_32(M[11]); W[12] = bswap_32(M[12]); W[13] = bswap_32(M[13]); W[14] = bswap_32(M[14]); W[15] = bswap_32(M[15]); TEMP = W[13] ^ W[8] ^ W[2] ^ W[0]; W[16] = S1(TEMP); TEMP = W[14] ^ W[9] ^ W[3] ^ W[1]; W[17] = S1(TEMP); TEMP = W[15] ^ W[10] ^ W[4] ^ W[2]; W[18] = S1(TEMP); TEMP = W[16] ^ W[11] ^ W[5] ^ W[3]; W[19] = S1(TEMP); TEMP = W[17] ^ W[12] ^ W[6] ^ W[4]; W[20] = S1(TEMP); TEMP = W[18] ^ W[13] ^ W[7] ^ W[5]; W[21] = S1(TEMP); TEMP = W[19] ^ W[14] ^ W[8] ^ W[6]; W[22] = S1(TEMP); TEMP = W[20] ^ W[15] ^ W[9] ^ W[7]; W[23] = S1(TEMP); TEMP = W[21] ^ W[16] ^ W[10] ^ W[8]; W[24] = S1(TEMP); TEMP = W[22] ^ W[17] ^ W[11] ^ W[9]; W[25] = S1(TEMP); TEMP = W[23] ^ W[18] ^ W[12] ^ W[10]; W[26] = S1(TEMP); TEMP = W[24] ^ W[19] ^ W[13] ^ W[11]; W[27] = S1(TEMP); TEMP = W[25] ^ W[20] ^ W[14] ^ W[12]; W[28] = S1(TEMP); TEMP = W[26] ^ W[21] ^ W[15] ^ W[13]; W[29] = S1(TEMP); TEMP = W[27] ^ W[22] ^ W[16] ^ W[14]; W[30] = S1(TEMP); TEMP = W[28] ^ W[23] ^ W[17] ^ W[15]; W[31] = S1(TEMP); /* process the remainder of the array */ for (t=32; t < 80; t++) { TEMP = W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]; W[t] = S1(TEMP); } A = H0; B = H1; C = H2; D = H3; E = H4; for (t=0; t < 20; t++) { TEMP = S5(A) + f0(B,C,D) + E + W[t] + SHA_K0; E = D; D = C; C = S30(B); B = A; A = TEMP; } for ( ; t < 40; t++) { TEMP = S5(A) + f1(B,C,D) + E + W[t] + SHA_K1; E = D; D = C; C = S30(B); B = A; A = TEMP; } for ( ; t < 60; t++) { TEMP = S5(A) + f2(B,C,D) + E + W[t] + SHA_K2; E = D; D = C; C = S30(B); B = A; A = TEMP; } for ( ; t < 80; t++) { TEMP = S5(A) + f3(B,C,D) + E + W[t] + SHA_K3; E = D; D = C; C = S30(B); B = A; A = TEMP; } hash_value[0] = H0 + A; hash_value[1] = H1 + B; hash_value[2] = H2 + C; hash_value[3] = H3 + D; hash_value[4] = H4 + E; return; }
void sha1_final(sha1_ctx_t *ctx, uint32_t *output) { uint32_t A, B, C, D, E, TEMP; uint32_t W[80]; int i, t; /* * process the remaining octets_in_buffer, padding and terminating as * necessary */ { int tail = ctx->octets_in_buffer % 4; /* copy/xor message into array */ for (i=0; i < (ctx->octets_in_buffer+3)/4; i++) W[i] = bswap_32(ctx->M[i]); /* why no bswap_32() here? - DAM */ /* set the high bit of the octet immediately following the message */ switch (tail) { case (3): W[i-1] = (bswap_32(ctx->M[i-1]) & 0xffffff00) | 0x80; W[i] = 0x0; break; case (2): W[i-1] = (bswap_32(ctx->M[i-1]) & 0xffff0000) | 0x8000; W[i] = 0x0; break; case (1): W[i-1] = (bswap_32(ctx->M[i-1]) & 0xff000000) | 0x800000; W[i] = 0x0; break; case (0): W[i] = 0x80000000; break; } /* zeroize remaining words */ for (i++ ; i < 15; i++) W[i] = 0x0; /* * if there is room at the end of the word array, then set the * last word to the bit-length of the message; otherwise, set that * word to zero and then we need to do one more run of the * compression algo. */ if (ctx->octets_in_buffer < 56) W[15] = ctx->num_bits_in_msg; else W[15] = 0x0; /* process the word array */ for (t=16; t < 80; t++) { TEMP = W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]; W[t] = S1(TEMP); } A = ctx->H[0]; B = ctx->H[1]; C = ctx->H[2]; D = ctx->H[3]; E = ctx->H[4]; for (t=0; t < 20; t++) { TEMP = S5(A) + f0(B,C,D) + E + W[t] + SHA_K0; E = D; D = C; C = S30(B); B = A; A = TEMP; } for ( ; t < 40; t++) { TEMP = S5(A) + f1(B,C,D) + E + W[t] + SHA_K1; E = D; D = C; C = S30(B); B = A; A = TEMP; } for ( ; t < 60; t++) { TEMP = S5(A) + f2(B,C,D) + E + W[t] + SHA_K2; E = D; D = C; C = S30(B); B = A; A = TEMP; } for ( ; t < 80; t++) { TEMP = S5(A) + f3(B,C,D) + E + W[t] + SHA_K3; E = D; D = C; C = S30(B); B = A; A = TEMP; } ctx->H[0] += A; ctx->H[1] += B; ctx->H[2] += C; ctx->H[3] += D; ctx->H[4] += E; } debug_print(mod_sha1, "(final) running sha1_core()", NULL); if (ctx->octets_in_buffer >= 56) { debug_print(mod_sha1, "(final) running sha1_core() again", NULL); /* we need to do one final run of the compression algo */ /* * set initial part of word array to zeros, and set the * final part to the number of bits in the message */ for (i=0; i < 15; i++) W[i] = 0x0; W[15] = ctx->num_bits_in_msg; /* process the word array */ for (t=16; t < 80; t++) { TEMP = W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]; W[t] = S1(TEMP); } A = ctx->H[0]; B = ctx->H[1]; C = ctx->H[2]; D = ctx->H[3]; E = ctx->H[4]; for (t=0; t < 20; t++) { TEMP = S5(A) + f0(B,C,D) + E + W[t] + SHA_K0; E = D; D = C; C = S30(B); B = A; A = TEMP; } for ( ; t < 40; t++) { TEMP = S5(A) + f1(B,C,D) + E + W[t] + SHA_K1; E = D; D = C; C = S30(B); B = A; A = TEMP; } for ( ; t < 60; t++) { TEMP = S5(A) + f2(B,C,D) + E + W[t] + SHA_K2; E = D; D = C; C = S30(B); B = A; A = TEMP; } for ( ; t < 80; t++) { TEMP = S5(A) + f3(B,C,D) + E + W[t] + SHA_K3; E = D; D = C; C = S30(B); B = A; A = TEMP; } ctx->H[0] += A; ctx->H[1] += B; ctx->H[2] += C; ctx->H[3] += D; ctx->H[4] += E; } /* copy result into output buffer */ output[0] = bswap_32(ctx->H[0]); output[1] = bswap_32(ctx->H[1]); output[2] = bswap_32(ctx->H[2]); output[3] = bswap_32(ctx->H[3]); output[4] = bswap_32(ctx->H[4]); /* indicate that message buffer in context is empty */ ctx->octets_in_buffer = 0; return; }
inline void SpawnTask::OnTriggerComplete() { m_triggerIsComplete = true; if(m_state == 1) { return S5(); } }
void test(int M, int N, int O, int P, int Q, int R, int S, int T, int U) { /* Scattering iterators. */ int c2, c4, c6; /* Original iterators. */ int i, j, k; if ((M >= 2) && (N >= 4)) { for (c2=1;c2<=O-1;c2++) { for (c6=1;c6<=M;c6++) { S1(c2,1,c6) ; } for (c6=1;c6<=M-1;c6++) { S6(c2,1,c6) ; S7(c2,1,c6) ; } for (c6=1;c6<=M;c6++) { S3(c2,1,c6) ; } for (c6=1;c6<=M-1;c6++) { S1(c2,2,c6) ; } S1(c2,2,M) ; for (c6=1;c6<=M-1;c6++) { S6(c2,2,c6) ; S7(c2,2,c6) ; } for (c6=1;c6<=M-1;c6++) { S11(c2,1,c6) ; } for (c4=3;c4<=2*N-5;c4++) { for (c6=1;c6<=M-1;c6++) { if ((c4+1)%2 == 0) { j = (c4-1)/2 ; S10(c2,(c4-1)/2,c6) ; } } for (c6=1;c6<=M;c6++) { if ((c4+1)%2 == 0) { j = (c4+1)/2 ; S3(c2,(c4+1)/2,c6) ; } } for (c6=1;c6<=M-1;c6++) { if (c4%2 == 0) { j = (c4+2)/2 ; S6(c2,(c4+2)/2,c6) ; S7(c2,(c4+2)/2,c6) ; } if ((c4+1)%2 == 0) { j = (c4+3)/2 ; S1(c2,(c4+3)/2,c6) ; } } if ((c4+1)%2 == 0) { j = (c4+3)/2 ; S1(c2,(c4+3)/2,M) ; } for (c6=1;c6<=M-1;c6++) { if (c4%2 == 0) { S11(c2,c4/2,c6) ; } } } c4 = 2*N-4 ; for (c6=1;c6<=M-1;c6++) { j = N-1 ; S6(c2,N-1,c6) ; S7(c2,N-1,c6) ; } for (c6=1;c6<=M-1;c6++) { j = N-2 ; S11(c2,N-2,c6) ; } c4 = 2*N-3 ; for (c6=1;c6<=M-1;c6++) { j = N-2 ; S10(c2,N-2,c6) ; } for (c6=1;c6<=M;c6++) { j = N-1 ; S3(c2,N-1,c6) ; } c4 = 2*N-2 ; for (c6=1;c6<=M-1;c6++) { j = N-1 ; S11(c2,N-1,c6) ; } c4 = 2*N-1 ; for (c6=1;c6<=M-1;c6++) { j = N-1 ; S10(c2,N-1,c6) ; } } } if ((M >= 2) && (N == 3)) { for (c2=1;c2<=O-1;c2++) { for (c6=1;c6<=M;c6++) { S1(c2,1,c6) ; } for (c6=1;c6<=M-1;c6++) { S6(c2,1,c6) ; S7(c2,1,c6) ; } for (c6=1;c6<=M;c6++) { S3(c2,1,c6) ; } for (c6=1;c6<=M-1;c6++) { S1(c2,2,c6) ; } S1(c2,2,M) ; for (c6=1;c6<=M-1;c6++) { S6(c2,2,c6) ; S7(c2,2,c6) ; } for (c6=1;c6<=M-1;c6++) { S11(c2,1,c6) ; } for (c6=1;c6<=M-1;c6++) { S10(c2,1,c6) ; } for (c6=1;c6<=M;c6++) { S3(c2,2,c6) ; } for (c6=1;c6<=M-1;c6++) { S11(c2,2,c6) ; } for (c6=1;c6<=M-1;c6++) { S10(c2,2,c6) ; } } } if ((M >= 2) && (N == 2)) { for (c2=1;c2<=O-1;c2++) { for (c6=1;c6<=M;c6++) { S1(c2,1,c6) ; } for (c6=1;c6<=M-1;c6++) { S6(c2,1,c6) ; S7(c2,1,c6) ; } for (c6=1;c6<=M;c6++) { S3(c2,1,c6) ; } for (c6=1;c6<=M-1;c6++) { S11(c2,1,c6) ; } for (c6=1;c6<=M-1;c6++) { S10(c2,1,c6) ; } } } if ((M == 1) && (N >= 3)) { for (c2=1;c2<=O-1;c2++) { for (c4=-1;c4<=0;c4++) { if ((c4+1)%2 == 0) { j = (c4+3)/2 ; S1(c2,(c4+3)/2,1) ; } } for (c4=1;c4<=2*N-5;c4++) { if ((c4+1)%2 == 0) { j = (c4+1)/2 ; S3(c2,(c4+1)/2,1) ; } if ((c4+1)%2 == 0) { j = (c4+3)/2 ; S1(c2,(c4+3)/2,1) ; } } for (c4=2*N-4;c4<=2*N-3;c4++) { if ((c4+1)%2 == 0) { j = (c4+1)/2 ; S3(c2,(c4+1)/2,1) ; } } } } if ((M == 1) && (N == 2)) { for (c2=1;c2<=O-1;c2++) { S1(c2,1,1) ; S3(c2,1,1) ; } } if ((M >= 2) && (N >= 3)) { for (c2=1;c2<=O-1;c2++) { for (c6=1;c6<=M;c6++) { S2(c2,1,c6) ; } for (c6=1;c6<=M-1;c6++) { S8(c2,1,c6) ; } for (c4=3;c4<=2*N-2;c4++) { for (c6=1;c6<=M;c6++) { if (c4%2 == 0) { S2(c2,c4/2,c6) ; } } for (c6=1;c6<=M-1;c6++) { if (c4%2 == 0) { S8(c2,c4/2,c6) ; } } for (c6=1;c6<=M-1;c6++) { if ((c4+1)%2 == 0) { j = (c4-1)/2 ; S9(c2,(c4-1)/2,c6) ; } } } c4 = 2*N-1 ; for (c6=1;c6<=M-1;c6++) { j = N-1 ; S9(c2,N-1,c6) ; } } } if ((M >= 2) && (N == 2)) { for (c2=1;c2<=O-1;c2++) { for (c6=1;c6<=M;c6++) { S2(c2,1,c6) ; } for (c6=1;c6<=M-1;c6++) { S8(c2,1,c6) ; } for (c6=1;c6<=M-1;c6++) { S9(c2,1,c6) ; } } } if ((M == 1) && (N >= 2)) { for (c2=1;c2<=O-1;c2++) { for (c4=2;c4<=2*N-2;c4++) { if (c4%2 == 0) { S2(c2,c4/2,1) ; } } } } if ((M >= 2) && (N >= 2)) { for (c2=1;c2<=O-1;c2++) { for (c4=1;c4<=N-1;c4++) { for (c6=1;c6<=M-1;c6++) { S4(c2,c4,c6) ; } } } } if ((M >= 2) && (N >= 2)) { for (c2=1;c2<=O-1;c2++) { for (c4=1;c4<=N-1;c4++) { for (c6=1;c6<=M-1;c6++) { S5(c2,c4,c6) ; } } } } if ((M >= P+1) && (N >= Q+1)) { for (c2=R;c2<=O-1;c2++) { for (c4=Q;c4<=N-1;c4++) { for (c6=P;c6<=M-1;c6++) { S12(c2,c4,c6) ; } } } } if ((M >= 2) && (N >= Q+1)) { for (c2=R;c2<=O-1;c2++) { for (c4=Q;c4<=N-1;c4++) { for (c6=1;c6<=M-1;c6++) { S13(c2,c4,c6) ; } } } } if ((M >= P+1) && (N >= 2)) { for (c2=R;c2<=O-1;c2++) { for (c4=1;c4<=N-1;c4++) { for (c6=P;c6<=M-1;c6++) { S14(c2,c4,c6) ; } } } } if ((M >= 2) && (N >= 2)) { for (c2=R;c2<=O-1;c2++) { for (c4=1;c4<=N-1;c4++) { for (c6=1;c6<=M-1;c6++) { S15(c2,c4,c6) ; } } } } }
void test(int M, int N, int O, int P, int Q, int R) { /* Scattering iterators. */ int p1, p3, p5; /* Original iterators. */ int i, j, k; if (M == 1) { S1() ; S2() ; S3() ; S4() ; S5() ; S6() ; S7() ; S8() ; S9() ; S10() ; S11() ; S12() ; S13() ; S14() ; S15() ; S16() ; S17() ; S18() ; S19() ; S20() ; S21() ; S22() ; S23() ; S24() ; S25() ; S26() ; S27() ; } if (M == 1) { for (p1=1;p1<=N;p1++) { for (p3=1;p3<=N;p3++) { S28(p1,p3) ; S29(p1,p3) ; S30(p1,p3) ; } S31(p1) ; } } if (M == 1) { S32() ; S33() ; S34() ; } if ((M == 1) && (O <= 1)) { S35() ; } if (M == 1) { S36() ; S37() ; } if ((M == 1) && (N >= 1) && (Q >= 1) && (R >= 1)) { for (p1=2;p1<=P;p1++) { S38(p1) ; S39(p1) ; for (p3=1;p3<=Q;p3++) { for (p5=1;p5<=R;p5++) { S40(p1,p3,p5) ; S41(p1,p3,p5) ; S42(p1,p3,p5) ; S43(p1,p3,p5) ; } } for (p3=1;p3<=Q;p3++) { S44(p1,p3) ; S45(p1,p3) ; S46(p1,p3) ; S47(p1,p3) ; } for (p3=1;p3<=R;p3++) { S48(p1,p3) ; S49(p1,p3) ; S50(p1,p3) ; S51(p1,p3) ; } S52(p1) ; S53(p1) ; S54(p1) ; S55(p1) ; S56(p1) ; S57(p1) ; S58(p1) ; for (p3=1;p3<=Q;p3++) { for (p5=1;p5<=R;p5++) { S59(p1,p3,p5) ; S60(p1,p3,p5) ; S61(p1,p3,p5) ; } } for (p3=1;p3<=Q;p3++) { S62(p1,p3) ; S63(p1,p3) ; S64(p1,p3) ; } for (p3=1;p3<=R;p3++) { S65(p1,p3) ; S66(p1,p3) ; S67(p1,p3) ; } S68(p1) ; S69(p1) ; S70(p1) ; S71(p1) ; S72(p1) ; S73(p1) ; S74(p1) ; S75(p1) ; S76(p1) ; S77(p1) ; S78(p1) ; S79(p1) ; S80(p1) ; S81(p1) ; S82(p1) ; S83(p1) ; S84(p1) ; S85(p1) ; S86(p1) ; S87(p1) ; S88(p1) ; S89(p1) ; S90(p1) ; S91(p1) ; S92(p1) ; S93(p1) ; S94(p1) ; for (p3=1;p3<=N;p3++) { for (p5=1;p5<=N;p5++) { S95(p1,p3,p5) ; S96(p1,p3,p5) ; S97(p1,p3,p5) ; } S98(p1,p3) ; } S99(p1) ; S100(p1) ; S101(p1) ; for (p3=1;p3<=Q;p3++) { for (p5=1;p5<=R;p5++) { S102(p1,p3,p5) ; S103(p1,p3,p5) ; S104(p1,p3,p5) ; S105(p1,p3,p5) ; S106(p1,p3,p5) ; S107(p1,p3,p5) ; } } for (p3=1;p3<=Q;p3++) { S108(p1,p3) ; S109(p1,p3) ; S110(p1,p3) ; S111(p1,p3) ; S112(p1,p3) ; S113(p1,p3) ; } for (p3=1;p3<=R;p3++) { S114(p1,p3) ; S115(p1,p3) ; S116(p1,p3) ; S117(p1,p3) ; S118(p1,p3) ; S119(p1,p3) ; } S120(p1) ; S121(p1) ; S122(p1) ; S123(p1) ; S124(p1) ; S125(p1) ; } } if ((M == 1) && (N <= 0) && (Q >= 1) && (R >= 1)) { for (p1=2;p1<=P;p1++) { S38(p1) ; S39(p1) ; for (p3=1;p3<=Q;p3++) { for (p5=1;p5<=R;p5++) { S40(p1,p3,p5) ; S41(p1,p3,p5) ; S42(p1,p3,p5) ; S43(p1,p3,p5) ; } } for (p3=1;p3<=Q;p3++) { S44(p1,p3) ; S45(p1,p3) ; S46(p1,p3) ; S47(p1,p3) ; } for (p3=1;p3<=R;p3++) { S48(p1,p3) ; S49(p1,p3) ; S50(p1,p3) ; S51(p1,p3) ; } S52(p1) ; S53(p1) ; S54(p1) ; S55(p1) ; S56(p1) ; S57(p1) ; S58(p1) ; for (p3=1;p3<=Q;p3++) { for (p5=1;p5<=R;p5++) { S59(p1,p3,p5) ; S60(p1,p3,p5) ; S61(p1,p3,p5) ; } } for (p3=1;p3<=Q;p3++) { S62(p1,p3) ; S63(p1,p3) ; S64(p1,p3) ; } for (p3=1;p3<=R;p3++) { S65(p1,p3) ; S66(p1,p3) ; S67(p1,p3) ; } S68(p1) ; S69(p1) ; S70(p1) ; S71(p1) ; S72(p1) ; S73(p1) ; S74(p1) ; S75(p1) ; S76(p1) ; S77(p1) ; S78(p1) ; S79(p1) ; S80(p1) ; S81(p1) ; S82(p1) ; S83(p1) ; S84(p1) ; S85(p1) ; S86(p1) ; S87(p1) ; S88(p1) ; S89(p1) ; S90(p1) ; S91(p1) ; S92(p1) ; S93(p1) ; S94(p1) ; S99(p1) ; S100(p1) ; S101(p1) ; for (p3=1;p3<=Q;p3++) { for (p5=1;p5<=R;p5++) { S102(p1,p3,p5) ; S103(p1,p3,p5) ; S104(p1,p3,p5) ; S105(p1,p3,p5) ; S106(p1,p3,p5) ; S107(p1,p3,p5) ; } } for (p3=1;p3<=Q;p3++) { S108(p1,p3) ; S109(p1,p3) ; S110(p1,p3) ; S111(p1,p3) ; S112(p1,p3) ; S113(p1,p3) ; } for (p3=1;p3<=R;p3++) { S114(p1,p3) ; S115(p1,p3) ; S116(p1,p3) ; S117(p1,p3) ; S118(p1,p3) ; S119(p1,p3) ; } S120(p1) ; S121(p1) ; S122(p1) ; S123(p1) ; S124(p1) ; S125(p1) ; } } if ((M == 1) && (N >= 1) && (Q <= 0) && (R >= 1)) { for (p1=2;p1<=P;p1++) { S38(p1) ; S39(p1) ; for (p3=1;p3<=R;p3++) { S48(p1,p3) ; S49(p1,p3) ; S50(p1,p3) ; S51(p1,p3) ; } S52(p1) ; S53(p1) ; S54(p1) ; S55(p1) ; S56(p1) ; S57(p1) ; S58(p1) ; for (p3=1;p3<=R;p3++) { S65(p1,p3) ; S66(p1,p3) ; S67(p1,p3) ; } S68(p1) ; S69(p1) ; S70(p1) ; S71(p1) ; S72(p1) ; S73(p1) ; S74(p1) ; S75(p1) ; S76(p1) ; S77(p1) ; S78(p1) ; S79(p1) ; S80(p1) ; S81(p1) ; S82(p1) ; S83(p1) ; S84(p1) ; S85(p1) ; S86(p1) ; S87(p1) ; S88(p1) ; S89(p1) ; S90(p1) ; S91(p1) ; S92(p1) ; S93(p1) ; S94(p1) ; for (p3=1;p3<=N;p3++) { for (p5=1;p5<=N;p5++) { S95(p1,p3,p5) ; S96(p1,p3,p5) ; S97(p1,p3,p5) ; } S98(p1,p3) ; } S99(p1) ; S100(p1) ; S101(p1) ; for (p3=1;p3<=R;p3++) { S114(p1,p3) ; S115(p1,p3) ; S116(p1,p3) ; S117(p1,p3) ; S118(p1,p3) ; S119(p1,p3) ; } S120(p1) ; S121(p1) ; S122(p1) ; S123(p1) ; S124(p1) ; S125(p1) ; } } if ((M == 1) && (N <= 0) && (Q <= 0) && (R >= 1)) { for (p1=2;p1<=P;p1++) { S38(p1) ; S39(p1) ; for (p3=1;p3<=R;p3++) { S48(p1,p3) ; S49(p1,p3) ; S50(p1,p3) ; S51(p1,p3) ; } S52(p1) ; S53(p1) ; S54(p1) ; S55(p1) ; S56(p1) ; S57(p1) ; S58(p1) ; for (p3=1;p3<=R;p3++) { S65(p1,p3) ; S66(p1,p3) ; S67(p1,p3) ; } S68(p1) ; S69(p1) ; S70(p1) ; S71(p1) ; S72(p1) ; S73(p1) ; S74(p1) ; S75(p1) ; S76(p1) ; S77(p1) ; S78(p1) ; S79(p1) ; S80(p1) ; S81(p1) ; S82(p1) ; S83(p1) ; S84(p1) ; S85(p1) ; S86(p1) ; S87(p1) ; S88(p1) ; S89(p1) ; S90(p1) ; S91(p1) ; S92(p1) ; S93(p1) ; S94(p1) ; S99(p1) ; S100(p1) ; S101(p1) ; for (p3=1;p3<=R;p3++) { S114(p1,p3) ; S115(p1,p3) ; S116(p1,p3) ; S117(p1,p3) ; S118(p1,p3) ; S119(p1,p3) ; } S120(p1) ; S121(p1) ; S122(p1) ; S123(p1) ; S124(p1) ; S125(p1) ; } } if ((M == 1) && (N >= 1) && (Q <= 0) && (R <= 0)) { for (p1=2;p1<=P;p1++) { S38(p1) ; S39(p1) ; S52(p1) ; S53(p1) ; S54(p1) ; S55(p1) ; S56(p1) ; S57(p1) ; S58(p1) ; S68(p1) ; S69(p1) ; S70(p1) ; S71(p1) ; S72(p1) ; S73(p1) ; S74(p1) ; S75(p1) ; S76(p1) ; S77(p1) ; S78(p1) ; S79(p1) ; S80(p1) ; S81(p1) ; S82(p1) ; S83(p1) ; S84(p1) ; S85(p1) ; S86(p1) ; S87(p1) ; S88(p1) ; S89(p1) ; S90(p1) ; S91(p1) ; S92(p1) ; S93(p1) ; S94(p1) ; for (p3=1;p3<=N;p3++) { for (p5=1;p5<=N;p5++) { S95(p1,p3,p5) ; S96(p1,p3,p5) ; S97(p1,p3,p5) ; } S98(p1,p3) ; } S99(p1) ; S100(p1) ; S101(p1) ; S120(p1) ; S121(p1) ; S122(p1) ; S123(p1) ; S124(p1) ; S125(p1) ; } } if ((M == 1) && (N <= 0) && (Q <= 0) && (R <= 0)) { for (p1=2;p1<=P;p1++) { S38(p1) ; S39(p1) ; S52(p1) ; S53(p1) ; S54(p1) ; S55(p1) ; S56(p1) ; S57(p1) ; S58(p1) ; S68(p1) ; S69(p1) ; S70(p1) ; S71(p1) ; S72(p1) ; S73(p1) ; S74(p1) ; S75(p1) ; S76(p1) ; S77(p1) ; S78(p1) ; S79(p1) ; S80(p1) ; S81(p1) ; S82(p1) ; S83(p1) ; S84(p1) ; S85(p1) ; S86(p1) ; S87(p1) ; S88(p1) ; S89(p1) ; S90(p1) ; S91(p1) ; S92(p1) ; S93(p1) ; S94(p1) ; S99(p1) ; S100(p1) ; S101(p1) ; S120(p1) ; S121(p1) ; S122(p1) ; S123(p1) ; S124(p1) ; S125(p1) ; } } if ((M == 1) && (N >= 1) && (Q >= 1) && (R <= 0)) { for (p1=2;p1<=P;p1++) { S38(p1) ; S39(p1) ; for (p3=1;p3<=Q;p3++) { S44(p1,p3) ; S45(p1,p3) ; S46(p1,p3) ; S47(p1,p3) ; } S52(p1) ; S53(p1) ; S54(p1) ; S55(p1) ; S56(p1) ; S57(p1) ; S58(p1) ; for (p3=1;p3<=Q;p3++) { S62(p1,p3) ; S63(p1,p3) ; S64(p1,p3) ; } S68(p1) ; S69(p1) ; S70(p1) ; S71(p1) ; S72(p1) ; S73(p1) ; S74(p1) ; S75(p1) ; S76(p1) ; S77(p1) ; S78(p1) ; S79(p1) ; S80(p1) ; S81(p1) ; S82(p1) ; S83(p1) ; S84(p1) ; S85(p1) ; S86(p1) ; S87(p1) ; S88(p1) ; S89(p1) ; S90(p1) ; S91(p1) ; S92(p1) ; S93(p1) ; S94(p1) ; for (p3=1;p3<=N;p3++) { for (p5=1;p5<=N;p5++) { S95(p1,p3,p5) ; S96(p1,p3,p5) ; S97(p1,p3,p5) ; } S98(p1,p3) ; } S99(p1) ; S100(p1) ; S101(p1) ; for (p3=1;p3<=Q;p3++) { S108(p1,p3) ; S109(p1,p3) ; S110(p1,p3) ; S111(p1,p3) ; S112(p1,p3) ; S113(p1,p3) ; } S120(p1) ; S121(p1) ; S122(p1) ; S123(p1) ; S124(p1) ; S125(p1) ; } } if ((M == 1) && (N <= 0) && (Q >= 1) && (R <= 0)) { for (p1=2;p1<=P;p1++) { S38(p1) ; S39(p1) ; for (p3=1;p3<=Q;p3++) { S44(p1,p3) ; S45(p1,p3) ; S46(p1,p3) ; S47(p1,p3) ; } S52(p1) ; S53(p1) ; S54(p1) ; S55(p1) ; S56(p1) ; S57(p1) ; S58(p1) ; for (p3=1;p3<=Q;p3++) { S62(p1,p3) ; S63(p1,p3) ; S64(p1,p3) ; } S68(p1) ; S69(p1) ; S70(p1) ; S71(p1) ; S72(p1) ; S73(p1) ; S74(p1) ; S75(p1) ; S76(p1) ; S77(p1) ; S78(p1) ; S79(p1) ; S80(p1) ; S81(p1) ; S82(p1) ; S83(p1) ; S84(p1) ; S85(p1) ; S86(p1) ; S87(p1) ; S88(p1) ; S89(p1) ; S90(p1) ; S91(p1) ; S92(p1) ; S93(p1) ; S94(p1) ; S99(p1) ; S100(p1) ; S101(p1) ; for (p3=1;p3<=Q;p3++) { S108(p1,p3) ; S109(p1,p3) ; S110(p1,p3) ; S111(p1,p3) ; S112(p1,p3) ; S113(p1,p3) ; } S120(p1) ; S121(p1) ; S122(p1) ; S123(p1) ; S124(p1) ; S125(p1) ; } } }
struct S5 { int x; } f1() { return S5(); } // expected-error{{result type}}
SolidesP ConstruireNormale (FacesP Face) // Construit un solide symbolisant la normale à la face. // Le solide est placé sur le barycentre de la face et peut donc // être hors de la face. // Sa longueur est égale à 5% de la dimension du solide à laquelle la // face appartient s'il existe. Sinon, c'est 10 % de la dimension de la face. { SolidesP Sol = Face.Solide () ; double HauteurTot ; Englobants3D EnglobantFace = Face.Englobant () ; if (Sol.EstInitialise ()) { Englobants3D E = Sol.Englobant () ; Vecteurs3D V (E.BasGauche (),E.HautDroit ()) ; HauteurTot = 0.05*V.Norme () ; ; } else { Vecteurs3D V (EnglobantFace.BasGauche (),EnglobantFace.HautDroit ()) ; HauteurTot = 0.1*V.Norme () ; ; } double LargeurPied = HauteurTot / 24, LargeurTete = HauteurTot / 4, HauteurPied = (7./8.)*HauteurTot ; // Construction d'un repère centré sur le "barycentre" de la face, dont // le (xOy) correspond au plan de la face et dont le z est la normale à // la face. Points3D Origine = 0.5*(EnglobantFace.BasGauche ()+EnglobantFace.HautDroit ()) ; Vecteurs3D K = Face.VecteurNormal ().VecteurNorme (), U (Face.ContourExterieur ().IemeAreteOrientee (0).Origine ().Point3D (), Face.ContourExterieur ().IemeAreteOrientee (0).Extremite ().Point3D ()), I = (K & U).VecteurNorme (), J = (K & I).VecteurNorme () ; SommetsP S1 (Origine-LargeurPied/2*I - LargeurPied/2*J) ; SommetsP S2 (Origine-LargeurPied/2*I + LargeurPied/2*J) ; SommetsP S3 (Origine+LargeurPied/2*I + LargeurPied/2*J) ; SommetsP S4 (Origine+LargeurPied/2*I - LargeurPied/2*J) ; SommetsP S5 (Origine-LargeurPied/2*I - LargeurPied/2*J + HauteurPied*K) ; SommetsP S6 (Origine-LargeurPied/2*I + LargeurPied/2*J + HauteurPied*K) ; SommetsP S7 (Origine+LargeurPied/2*I + LargeurPied/2*J + HauteurPied*K) ; SommetsP S8 (Origine+LargeurPied/2*I - LargeurPied/2*J + HauteurPied*K) ; SommetsP S9 (Origine-LargeurTete/2*I - LargeurTete/2*J + HauteurPied*K) ; SommetsP S10 (Origine-LargeurTete/2*I + LargeurTete/2*J + HauteurPied*K) ; SommetsP S11 (Origine+LargeurTete/2*I + LargeurTete/2*J + HauteurPied*K) ; SommetsP S12 (Origine+LargeurTete/2*I - LargeurTete/2*J + HauteurPied*K) ; SommetsP S13 (Origine+HauteurTot*K) ; AretesP A1 (S1,S2) ; AretesP A2 (S2,S3) ; AretesP A3 (S3,S4) ; AretesP A4 (S4,S1) ; AretesP A5 (S5,S6) ; AretesP A6 (S6,S7) ; AretesP A7 (S7,S8) ; AretesP A8 (S8,S5) ; AretesP A9 (S9,S10) ; AretesP A10 (S10,S11) ; AretesP A11 (S11,S12) ; AretesP A12 (S12,S9) ; AretesP A13 (S1,S5) ; AretesP A14 (S2,S6) ; AretesP A15 (S3,S7) ; AretesP A16 (S4,S8) ; AretesP A17 (S9,S13) ; AretesP A18 (S10,S13) ; AretesP A19 (S11,S13) ; AretesP A20 (S12,S13) ; Listes <AretesP> L1 ; L1.InsertionEnQueue (A1) ; L1.InsertionEnQueue (A2) ; L1.InsertionEnQueue (A3) ; L1.InsertionEnQueue (A4) ; Listes <AretesP> L2 ; L2.InsertionEnQueue (A1) ; L2.InsertionEnQueue (A13) ; L2.InsertionEnQueue (A5) ; L2.InsertionEnQueue (A14) ; Listes <AretesP> L3 ; L3.InsertionEnQueue (A2) ; L3.InsertionEnQueue (A14) ; L3.InsertionEnQueue (A6) ; L3.InsertionEnQueue (A15) ; Listes <AretesP> L4 ; L4.InsertionEnQueue (A3) ; L4.InsertionEnQueue (A15) ; L4.InsertionEnQueue (A7) ; L4.InsertionEnQueue (A16) ; Listes <AretesP> L5 ; L5.InsertionEnQueue (A4) ; L5.InsertionEnQueue (A16) ; L5.InsertionEnQueue (A8) ; L5.InsertionEnQueue (A13) ; Listes <AretesP> L6 ; L6.InsertionEnQueue (A9) ; L6.InsertionEnQueue (A10) ; L6.InsertionEnQueue (A11) ; L6.InsertionEnQueue (A12) ; Listes <AretesP> L7 ; L7.InsertionEnQueue (A8) ; L7.InsertionEnQueue (A7) ; L7.InsertionEnQueue (A6) ; L7.InsertionEnQueue (A5) ; Listes <AretesP> L8 ; L8.InsertionEnQueue (A9) ; L8.InsertionEnQueue (A17) ; L8.InsertionEnQueue (A18) ; Listes <AretesP> L9 ; L9.InsertionEnQueue (A10) ; L9.InsertionEnQueue (A18) ; L9.InsertionEnQueue (A19) ; Listes <AretesP> L10 ; L10.InsertionEnQueue (A11) ; L10.InsertionEnQueue (A19) ; L10.InsertionEnQueue (A20) ; Listes <AretesP> L11 ; L11.InsertionEnQueue (A12) ; L11.InsertionEnQueue (A20) ; L11.InsertionEnQueue (A17) ; Listes <FacesP> ListeFaces ; AttributsFaces *PAF = new AttributsFaces (PMateriauRouge) ; FacesP F1 (ContoursP (L1),PAF) ; ListeFaces.InsertionEnQueue (F1) ; ListeFaces.InsertionEnQueue (FacesP (ContoursP (L2),PAF)) ; ListeFaces.InsertionEnQueue (FacesP (ContoursP (L3),PAF)) ; ListeFaces.InsertionEnQueue (FacesP (ContoursP (L4),PAF)) ; ListeFaces.InsertionEnQueue (FacesP (ContoursP (L5),PAF)) ; ContoursP C (L6) ; FacesP F (C,PAF) ; F.AjouterContourInterieur (ContoursP (L7)) ; ListeFaces.InsertionEnQueue (F) ; ListeFaces.InsertionEnQueue (FacesP (ContoursP (L8),PAF)) ; ListeFaces.InsertionEnQueue (FacesP (ContoursP (L9),PAF)) ; ListeFaces.InsertionEnQueue (FacesP (ContoursP (L10),PAF)) ; ListeFaces.InsertionEnQueue (FacesP (ContoursP (L11),PAF)) ; return SolidesP (ListeFaces) ; }
void test(int m) { /* Scattering iterators. */ int glT1, rp1, local1, local2; /* Original iterators. */ int coordT1, coordP1, other1, other2, other3, other4, other5, other6; if (m >= 2) { S1(0,1,1,1) ; S2(0,1,1,1,1,1,2,1) ; S3(0,1,1,2,1,1,1,2) ; S4(0,1,2,2,1,1,2,2) ; S8(0,1) ; } if (m == 1) { S1(0,1,1,1) ; S8(0,1) ; } if (m >= 3) { S5(0,1,1,1,1,1,2,1) ; S1(1,1,2,1) ; S2(1,1,2,1,2,1,3,1) ; S3(1,1,2,2,2,1,2,2) ; S4(1,1,3,2,2,1,3,2) ; S6(0,1,1,2,1,1,1,2) ; S7(0,1,2,2,1,1,2,2) ; S1(1,2,1,2) ; S2(1,2,2,2,1,2,2,2) ; S3(1,2,2,3,1,2,1,3) ; S4(1,2,3,3,1,2,2,3) ; for (coordP1=1;coordP1<=2;coordP1++) { S8(1,coordP1) ; } } for (glT1=2;glT1<=m-2;glT1++) { coordT1 = glT1-1 ; other5 = glT1+1 ; S5(glT1-1,1,glT1,1,glT1,1,glT1+1,1) ; other1 = glT1+1 ; S1(glT1,1,glT1+1,1) ; local1 = glT1+1 ; other1 = glT1+1 ; other3 = glT1+1 ; other5 = glT1+2 ; S2(glT1,1,glT1+1,1,glT1+1,1,glT1+2,1) ; other3 = glT1+1 ; other5 = glT1+1 ; S3(glT1,1,glT1+1,2,glT1+1,1,glT1+1,2) ; other1 = glT1+2 ; other3 = glT1+1 ; other5 = glT1+2 ; S4(glT1,1,glT1+2,2,glT1+1,1,glT1+2,2) ; for (rp1=2;rp1<=glT1;rp1++) { local1 = glT1-rp1+1 ; coordT1 = glT1-1 ; other3 = glT1-rp1+1 ; other5 = glT1-rp1+2 ; S5(glT1-1,rp1,glT1,rp1,glT1-rp1+1,rp1,glT1-rp1+2,rp1) ; local1 = glT1-rp1+2 ; local2 = rp1-1 ; coordT1 = glT1-1 ; coordP1 = rp1-1 ; other3 = glT1-rp1+2 ; other4 = rp1-1 ; other5 = glT1-rp1+2 ; S6(glT1-1,rp1-1,glT1,rp1,glT1-rp1+2,rp1-1,glT1-rp1+2,rp1) ; other1 = glT1+1 ; other3 = glT1-rp1+2 ; other4 = rp1-1 ; other5 = glT1-rp1+3 ; S7(glT1-1,rp1-1,glT1+1,rp1,glT1-rp1+2,rp1-1,glT1-rp1+3,rp1) ; other1 = glT1-rp1+2 ; S1(glT1,rp1,glT1-rp1+2,rp1) ; local1 = glT1-rp1+2 ; other1 = glT1+1 ; other3 = glT1-rp1+2 ; other5 = glT1-rp1+3 ; S2(glT1,rp1,glT1+1,rp1,glT1-rp1+2,rp1,glT1-rp1+3,rp1) ; other2 = rp1+1 ; other3 = glT1-rp1+2 ; other5 = glT1-rp1+2 ; other6 = rp1+1 ; S3(glT1,rp1,glT1+1,rp1+1,glT1-rp1+2,rp1,glT1-rp1+2,rp1+1) ; other1 = glT1+2 ; other2 = rp1+1 ; other3 = glT1-rp1+2 ; other5 = glT1-rp1+3 ; other6 = rp1+1 ; S4(glT1,rp1,glT1+2,rp1+1,glT1-rp1+2,rp1,glT1-rp1+3,rp1+1) ; } rp1 = glT1+1 ; coordT1 = glT1-1 ; other2 = glT1+1 ; other6 = glT1+1 ; S6(glT1-1,glT1,glT1,glT1+1,1,glT1,1,glT1+1) ; other1 = glT1+1 ; other2 = glT1+1 ; other6 = glT1+1 ; S7(glT1-1,glT1,glT1+1,glT1+1,1,glT1,2,glT1+1) ; coordP1 = glT1+1 ; other2 = glT1+1 ; S1(glT1,glT1+1,1,glT1+1) ; local2 = glT1+1 ; coordP1 = glT1+1 ; other1 = glT1+1 ; other2 = glT1+1 ; other4 = glT1+1 ; other6 = glT1+1 ; S2(glT1,glT1+1,glT1+1,glT1+1,1,glT1+1,2,glT1+1) ; other2 = glT1+2 ; other4 = glT1+1 ; other6 = glT1+2 ; S3(glT1,glT1+1,glT1+1,glT1+2,1,glT1+1,1,glT1+2) ; other1 = glT1+2 ; other2 = glT1+2 ; other4 = glT1+1 ; other6 = glT1+2 ; S4(glT1,glT1+1,glT1+2,glT1+2,1,glT1+1,2,glT1+2) ; for (coordP1=1;coordP1<=glT1+1;coordP1++) { S8(glT1,coordP1) ; } } if (m >= 3) { glT1 = m-1 ; local1 = m-1 ; coordT1 = m-2 ; other1 = m-1 ; other3 = m-1 ; S5(m-2,1,m-1,1,m-1,1,m,1) ; coordT1 = m-1 ; S1(m-1,1,m,1) ; coordT1 = m-1 ; S3(m-1,1,m,2,m,1,m,2) ; for (rp1=2;rp1<=m-1;rp1++) { local1 = -rp1+m ; coordT1 = m-2 ; other1 = m-1 ; other3 = -rp1+m ; other5 = -rp1+m+1 ; S5(m-2,rp1,m-1,rp1,-rp1+m,rp1,-rp1+m+1,rp1) ; local1 = -rp1+m+1 ; local2 = rp1-1 ; coordT1 = m-2 ; coordP1 = rp1-1 ; other1 = m-1 ; other3 = -rp1+m+1 ; other4 = rp1-1 ; other5 = -rp1+m+1 ; S6(m-2,rp1-1,m-1,rp1,-rp1+m+1,rp1-1,-rp1+m+1,rp1) ; other3 = -rp1+m+1 ; other4 = rp1-1 ; other5 = -rp1+m+2 ; S7(m-2,rp1-1,m,rp1,-rp1+m+1,rp1-1,-rp1+m+2,rp1) ; coordT1 = m-1 ; other1 = -rp1+m+1 ; S1(m-1,rp1,-rp1+m+1,rp1) ; local1 = -rp1+m+1 ; coordT1 = m-1 ; other3 = -rp1+m+1 ; other5 = -rp1+m+2 ; S2(m-1,rp1,m,rp1,-rp1+m+1,rp1,-rp1+m+2,rp1) ; other2 = rp1+1 ; other3 = -rp1+m+1 ; other5 = -rp1+m+1 ; other6 = rp1+1 ; S3(m-1,rp1,m,rp1+1,-rp1+m+1,rp1,-rp1+m+1,rp1+1) ; other1 = m+1 ; other2 = rp1+1 ; other3 = -rp1+m+1 ; other5 = -rp1+m+2 ; other6 = rp1+1 ; S4(m-1,rp1,m+1,rp1+1,-rp1+m+1,rp1,-rp1+m+2,rp1+1) ; } local2 = m-1 ; coordT1 = m-2 ; coordP1 = m-1 ; other1 = m-1 ; other4 = m-1 ; S6(m-2,m-1,m-1,m,1,m-1,1,m) ; other4 = m-1 ; S7(m-2,m-1,m,m,1,m-1,2,m) ; coordT1 = m-1 ; S1(m-1,m,1,m) ; coordT1 = m-1 ; S2(m-1,m,m,m,1,m,2,m) ; coordT1 = m-1 ; for (coordP1=1;coordP1<=m;coordP1++) { S8(m-1,coordP1) ; } } for (glT1=m;glT1<=2*m-4;glT1++) { rp1 = glT1-m+2 ; local1 = m-1 ; local2 = glT1-m+2 ; coordT1 = glT1-1 ; coordP1 = glT1-m+2 ; other2 = glT1-m+2 ; other3 = m-1 ; other4 = glT1-m+2 ; other6 = glT1-m+2 ; S5(glT1-1,glT1-m+2,glT1,glT1-m+2,m-1,glT1-m+2,m,glT1-m+2) ; local2 = glT1-m+1 ; coordT1 = glT1-1 ; coordP1 = glT1-m+1 ; other2 = glT1-m+2 ; other4 = glT1-m+1 ; other6 = glT1-m+2 ; S6(glT1-1,glT1-m+1,glT1,glT1-m+2,m,glT1-m+1,m,glT1-m+2) ; coordP1 = glT1-m+2 ; other2 = glT1-m+2 ; S1(glT1,glT1-m+2,m,glT1-m+2) ; local2 = glT1-m+2 ; coordP1 = glT1-m+2 ; other1 = glT1+1 ; other2 = glT1-m+3 ; other4 = glT1-m+2 ; other6 = glT1-m+3 ; S3(glT1,glT1-m+2,glT1+1,glT1-m+3,m,glT1-m+2,m,glT1-m+3) ; for (rp1=glT1-m+3;rp1<=m-1;rp1++) { local1 = glT1-rp1+1 ; coordT1 = glT1-1 ; other3 = glT1-rp1+1 ; other5 = glT1-rp1+2 ; S5(glT1-1,rp1,glT1,rp1,glT1-rp1+1,rp1,glT1-rp1+2,rp1) ; local1 = glT1-rp1+2 ; local2 = rp1-1 ; coordT1 = glT1-1 ; coordP1 = rp1-1 ; other3 = glT1-rp1+2 ; other4 = rp1-1 ; other5 = glT1-rp1+2 ; S6(glT1-1,rp1-1,glT1,rp1,glT1-rp1+2,rp1-1,glT1-rp1+2,rp1) ; other1 = glT1+1 ; other3 = glT1-rp1+2 ; other4 = rp1-1 ; other5 = glT1-rp1+3 ; S7(glT1-1,rp1-1,glT1+1,rp1,glT1-rp1+2,rp1-1,glT1-rp1+3,rp1) ; other1 = glT1-rp1+2 ; S1(glT1,rp1,glT1-rp1+2,rp1) ; local1 = glT1-rp1+2 ; other1 = glT1+1 ; other3 = glT1-rp1+2 ; other5 = glT1-rp1+3 ; S2(glT1,rp1,glT1+1,rp1,glT1-rp1+2,rp1,glT1-rp1+3,rp1) ; other2 = rp1+1 ; other3 = glT1-rp1+2 ; other5 = glT1-rp1+2 ; other6 = rp1+1 ; S3(glT1,rp1,glT1+1,rp1+1,glT1-rp1+2,rp1,glT1-rp1+2,rp1+1) ; other1 = glT1+2 ; other2 = rp1+1 ; other3 = glT1-rp1+2 ; other5 = glT1-rp1+3 ; other6 = rp1+1 ; S4(glT1,rp1,glT1+2,rp1+1,glT1-rp1+2,rp1,glT1-rp1+3,rp1+1) ; } local1 = glT1-m+1 ; coordT1 = glT1-1 ; other3 = glT1-m+1 ; other5 = glT1-m+2 ; S5(glT1-1,m,glT1,m,glT1-m+1,m,glT1-m+2,m) ; local1 = glT1-m+2 ; local2 = m-1 ; coordT1 = glT1-1 ; coordP1 = m-1 ; other3 = glT1-m+2 ; other4 = m-1 ; other5 = glT1-m+2 ; S6(glT1-1,m-1,glT1,m,glT1-m+2,m-1,glT1-m+2,m) ; other1 = glT1+1 ; other3 = glT1-m+2 ; other4 = m-1 ; other5 = glT1-m+3 ; S7(glT1-1,m-1,glT1+1,m,glT1-m+2,m-1,glT1-m+3,m) ; other1 = glT1-m+2 ; S1(glT1,m,glT1-m+2,m) ; local1 = glT1-m+2 ; other1 = glT1+1 ; other3 = glT1-m+2 ; other5 = glT1-m+3 ; S2(glT1,m,glT1+1,m,glT1-m+2,m,glT1-m+3,m) ; for (coordP1=glT1-m+2;coordP1<=m;coordP1++) { S8(glT1,coordP1) ; } } if (m >= 3) { glT1 = 2*m-3 ; rp1 = m-1 ; local1 = m-1 ; local2 = m-1 ; coordT1 = 2*m-4 ; coordP1 = m-1 ; other1 = 2*m-3 ; other2 = m-1 ; other3 = m-1 ; other4 = m-1 ; other6 = m-1 ; S5(2*m-4,m-1,2*m-3,m-1,m-1,m-1,m,m-1) ; local2 = m-2 ; coordT1 = 2*m-4 ; coordP1 = m-2 ; other1 = 2*m-3 ; other2 = m-1 ; other4 = m-2 ; other6 = m-1 ; S6(2*m-4,m-2,2*m-3,m-1,m,m-2,m,m-1) ; coordT1 = 2*m-3 ; coordP1 = m-1 ; other2 = m-1 ; S1(2*m-3,m-1,m,m-1) ; local2 = m-1 ; coordT1 = 2*m-3 ; coordP1 = m-1 ; other1 = 2*m-2 ; other4 = m-1 ; S3(2*m-3,m-1,2*m-2,m,m,m-1,m,m) ; local1 = m-2 ; coordT1 = 2*m-4 ; other1 = 2*m-3 ; other3 = m-2 ; other5 = m-1 ; S5(2*m-4,m,2*m-3,m,m-2,m,m-1,m) ; local1 = m-1 ; local2 = m-1 ; coordT1 = 2*m-4 ; coordP1 = m-1 ; other1 = 2*m-3 ; other3 = m-1 ; other4 = m-1 ; other5 = m-1 ; S6(2*m-4,m-1,2*m-3,m,m-1,m-1,m-1,m) ; other1 = 2*m-2 ; other3 = m-1 ; other4 = m-1 ; S7(2*m-4,m-1,2*m-2,m,m-1,m-1,m,m) ; coordT1 = 2*m-3 ; other1 = m-1 ; S1(2*m-3,m,m-1,m) ; local1 = m-1 ; coordT1 = 2*m-3 ; other1 = 2*m-2 ; other3 = m-1 ; S2(2*m-3,m,2*m-2,m,m-1,m,m,m) ; coordT1 = 2*m-3 ; for (coordP1=m-1;coordP1<=m;coordP1++) { S8(2*m-3,coordP1) ; } } if (m == 2) { S5(0,1,1,1,1,1,2,1) ; S1(1,1,2,1) ; S3(1,1,2,2,2,1,2,2) ; S6(0,1,1,2,1,1,1,2) ; S7(0,1,2,2,1,1,2,2) ; S1(1,2,1,2) ; S2(1,2,2,2,1,2,2,2) ; for (coordP1=1;coordP1<=2;coordP1++) { S8(1,coordP1) ; } } if (m >= 2) { glT1 = 2*m-2 ; local1 = m-1 ; coordT1 = 2*m-3 ; other1 = 2*m-2 ; other3 = m-1 ; S5(2*m-3,m,2*m-2,m,m-1,m,m,m) ; local2 = m-1 ; coordT1 = 2*m-3 ; coordP1 = m-1 ; other1 = 2*m-2 ; other4 = m-1 ; S6(2*m-3,m-1,2*m-2,m,m,m-1,m,m) ; coordT1 = 2*m-2 ; S1(2*m-2,m,m,m) ; coordT1 = 2*m-2 ; S8(2*m-2,m) ; } }