void encipher(unsigned long *const v,unsigned long *const w,
const unsigned long *const k)
{
register unsigned long y=v[0],z=v[1],sum=0,delta=0x9E3779B9,
a=k[0],b=k[1],c=k[2],d=k[3],n=32;
ivan escreveu:[code]
... unsigned long *const - comparar o help dp Borland C com o o do compilador usado no exemplo...
ivan escreveu:Então posta as msgs de erro
tea main.c: In function `encipher':
tea main.c:10: error: subscripted value is neither array nor pointer
tea main.c:10: error: subscripted value is neither array nor pointer
tea main.c:10: error: subscripted value is neither array nor pointer
tea main.c:11: error: subscripted value is neither array nor pointer
tea main.c:11: error: subscripted value is neither array nor pointer
tea main.c:11: error: subscripted value is neither array nor pointer
tea main.c:20: error: subscripted value is neither array nor pointer
tea main.c:20: error: subscripted value is neither array nor pointer
tea main.c: In function `decipher':
tea main.c:26: error: subscripted value is neither array nor pointer
tea main.c:26: error: subscripted value is neither array nor pointer
tea main.c:27: error: subscripted value is neither array nor pointer
tea main.c:27: error: subscripted value is neither array nor pointer
tea main.c:28: error: subscripted value is neither array nor pointer
tea main.c:28: error: subscripted value is neither array nor pointer
tea main.c:39: error: subscripted value is neither array nor pointer
tea main.c:39: error: subscripted value is neither array nor pointer
make.exe: *** ["tea main.o"] Error 1
Execução terminada
ivan escreveu:Marcelo,
Ao consultar o site http://www.acm.uiuc.edu/webmonkeys/book/c_guide/
vi q não existe o tipo "register" no C ANSI.
Ainda estou baixando o Cygwin pra compilar e ver os erros.
void encipher(unsigned int num_rounds, unsigned long* v, unsigned long* k) {
unsigned long v0=v[0], v1=v[1], i;
unsigned long sum=0, delta=0x9E3779B9;
for(i=0; i<num_rounds; i++) {
v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + k[sum & 3]);
sum += delta;
v1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum>>11) & 3]);
}
v[0]=v0; v[1]=v1;
}
polesapart escreveu:Uso este código aqui com o gcc, sem problemas:
- Código: Selecionar todos
void encipher(unsigned int num_rounds, unsigned long* v, unsigned long* k) {
unsigned long v0=v[0], v1=v[1], i;
unsigned long sum=0, delta=0x9E3779B9;
for(i=0; i<num_rounds; i++) {
v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + k[sum & 3]);
sum += delta;
v1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum>>11) & 3]);
}
v[0]=v0; v[1]=v1;
}
Voltar para Visual C++/C/C++/C#
Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante