/** ********************************************************************* * @file rc5_defs.h * @author petrucio@inf.ufsc.br ********************************************************************/ #ifndef PET_RC5DEFS_H #define PET_RC5DEFS_H /*** * Mudar isso pra compilar em plataforma de palavra diferente ***********************************/ #define WORD_32 /*** * Definições dependentes de plataforma ***********************************/ // Plataforma de 32 bits #ifdef WORD_32 #define WSIZE 32 // w #define WORD unsigned long int const WORD magicP = 0xb7E15163; // Constantes magicas const WORD magicQ = 0x9E3779B9; #endif // Plataforma de 16 bits #ifdef WORD_16 #define WSIZE 16 #define WORD unsigned short int const WORD magicP = 0xb7E1; const WORD magicQ = 0x9E37; #endif // Plataforma de 8 bits #ifdef WORD_8 #define WSIZE 8 #define WORD unsigned char const WORD magicP = 0xb7; const WORD magicQ = 0x9E; #endif // Plataforma de 64 bits #ifdef WORD_64 #define WSIZE 64 #define WORD unsigned long long int const WORD magicP = 0xb7E151628AED2A6B; const WORD magicQ = 0x9E3779B97F4A7C15; #endif // Testa se foi definida alguma plataforma #ifndef WSIZE #error "Plataforma indefinida (Defina WORD_XX)" #endif // BPW = bytes per word const int BPW = WSIZE / 8; /*** * Rotation Macros ***********************************/ #define ROTL(x,y) (((x)<<(y&(WSIZE-1))) | ((x)>>(WSIZE-(y&(WSIZE-1))))) #define ROTR(x,y) (((x)>>(y&(WSIZE-1))) | ((x)<<(WSIZE-(y&(WSIZE-1))))) #ifndef UCHAR #define UCHAR unsigned char #endif #endif // PET_RC5DEFS_H