mirror of
https://github.com/cc65/cc65.git
synced 2024-06-15 17:30:06 +00:00
remove TABs which again slipped in....
This commit is contained in:
parent
d67b955e52
commit
ef258bdc19
|
@ -23,10 +23,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SQP_KEEP_NONE 0x00
|
#define SQP_KEEP_NONE 0x00
|
||||||
#define SQP_KEEP_TEST 0x01U
|
#define SQP_KEEP_TEST 0x01U
|
||||||
#define SQP_KEEP_EAX 0x02U
|
#define SQP_KEEP_EAX 0x02U
|
||||||
#define SQP_KEEP_EXPR 0x03U /* SQP_KEEP_TEST | SQP_KEEP_EAX */
|
#define SQP_KEEP_EXPR 0x03U /* SQP_KEEP_TEST | SQP_KEEP_EAX */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
1044
test/val/binlit.c
1044
test/val/binlit.c
File diff suppressed because it is too large
Load Diff
|
@ -7,24 +7,24 @@
|
||||||
|
|
||||||
struct ImageStruct
|
struct ImageStruct
|
||||||
{
|
{
|
||||||
uint8_t _imageData;
|
uint8_t _imageData;
|
||||||
#if !defined(NO_COLOR)
|
#if !defined(NO_COLOR)
|
||||||
uint8_t _color;
|
uint8_t _color;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct ImageStruct Image;
|
typedef struct ImageStruct Image;
|
||||||
|
|
||||||
struct CharacterStruct
|
struct CharacterStruct
|
||||||
{
|
{
|
||||||
// character coordinates
|
// character coordinates
|
||||||
uint8_t _x;
|
uint8_t _x;
|
||||||
uint8_t _y;
|
uint8_t _y;
|
||||||
|
|
||||||
// _status decides whether the character is active
|
// _status decides whether the character is active
|
||||||
uint8_t _status;
|
uint8_t _status;
|
||||||
|
|
||||||
Image* _imagePtr;
|
Image* _imagePtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct CharacterStruct Character;
|
typedef struct CharacterStruct Character;
|
||||||
|
@ -53,20 +53,20 @@ Character bombs[BOMBS_NUMBER];
|
||||||
|
|
||||||
uint16_t test1(void)
|
uint16_t test1(void)
|
||||||
{
|
{
|
||||||
if((loop<MAX_GHOST_LOOP) && (ghostLevel<MAX_GHOST_LEVEL))
|
if((loop<MAX_GHOST_LOOP) && (ghostLevel<MAX_GHOST_LEVEL))
|
||||||
{
|
{
|
||||||
return INITIAL_GHOST_SLOWDOWN-(uint16_t)level*256-ghostLevel*8;
|
return INITIAL_GHOST_SLOWDOWN-(uint16_t)level*256-ghostLevel*8;
|
||||||
}
|
}
|
||||||
return GHOST_MIN_SLOWDOWN;
|
return GHOST_MIN_SLOWDOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t test2(void)
|
uint16_t test2(void)
|
||||||
{
|
{
|
||||||
if((loop<MAX_GHOST_LOOP) && (ghostLevel<MAX_GHOST_LEVEL))
|
if((loop<MAX_GHOST_LOOP) && (ghostLevel<MAX_GHOST_LEVEL))
|
||||||
{
|
{
|
||||||
return INITIAL_GHOST_SLOWDOWN-(uint16_t)level*256-ghostLevel*16;
|
return INITIAL_GHOST_SLOWDOWN-(uint16_t)level*256-ghostLevel*16;
|
||||||
}
|
}
|
||||||
return GHOST_MIN_SLOWDOWN;
|
return GHOST_MIN_SLOWDOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t res = 0;
|
uint16_t res = 0;
|
||||||
|
|
134
test/val/rand.c
134
test/val/rand.c
|
@ -28,83 +28,83 @@ static uint32_t seed;
|
||||||
|
|
||||||
int ref_rand()
|
int ref_rand()
|
||||||
{
|
{
|
||||||
uint16_t output;
|
uint16_t output;
|
||||||
/* seed follows the LCG sequence * 0x01010101 + 0xB3B3B3B3 */
|
/* seed follows the LCG sequence * 0x01010101 + 0xB3B3B3B3 */
|
||||||
seed = seed * 0x01010101UL + 0xB3B3B3B3UL;
|
seed = seed * 0x01010101UL + 0xB3B3B3B3UL;
|
||||||
/* output uses the top two bytes (reversed) XOR with bottom two bytes */
|
/* output uses the top two bytes (reversed) XOR with bottom two bytes */
|
||||||
{
|
{
|
||||||
uint16_t s0 = (seed >> 0) & 0xFF;
|
uint16_t s0 = (seed >> 0) & 0xFF;
|
||||||
uint16_t s1 = (seed >> 8) & 0xFF;
|
uint16_t s1 = (seed >> 8) & 0xFF;
|
||||||
uint16_t s2 = (seed >> 16) & 0xFF;
|
uint16_t s2 = (seed >> 16) & 0xFF;
|
||||||
uint16_t s3 = (seed >> 24) & 0xFF;
|
uint16_t s3 = (seed >> 24) & 0xFF;
|
||||||
uint16_t o0 = s3 ^ s1;
|
uint16_t o0 = s3 ^ s1;
|
||||||
uint16_t o1 = s2 ^ s0;
|
uint16_t o1 = s2 ^ s0;
|
||||||
output = o0 | (o1 << 8);
|
output = o0 | (o1 << 8);
|
||||||
}
|
}
|
||||||
return (int)(output & 0x7FFF);
|
return (int)(output & 0x7FFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ref_srand(int ax)
|
void ref_srand(int ax)
|
||||||
{
|
{
|
||||||
uint32_t s = (unsigned int)ax;
|
uint32_t s = (unsigned int)ax;
|
||||||
seed = s | (s << 16); /* low 16 bits is convenient filler for high 16 bits */
|
seed = s | (s << 16); /* low 16 bits is convenient filler for high 16 bits */
|
||||||
ref_rand(); /* one pre-call "shuffles" the first rand() result so it isn't too predictable */
|
ref_rand(); /* one pre-call "shuffles" the first rand() result so it isn't too predictable */
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
unsigned int i,j;
|
unsigned int i,j;
|
||||||
int a,b;
|
int a,b;
|
||||||
|
|
||||||
/* test that startup state is equivalent to srand(1) */
|
/* test that startup state is equivalent to srand(1) */
|
||||||
{
|
{
|
||||||
//srand(1); // implied
|
//srand(1); // implied
|
||||||
ref_srand(1);
|
ref_srand(1);
|
||||||
for (j=0; j<SUBTESTS; ++j)
|
for (j=0; j<SUBTESTS; ++j)
|
||||||
{
|
{
|
||||||
a = rand();
|
a = rand();
|
||||||
b = ref_rand();
|
b = ref_rand();
|
||||||
if (a != b)
|
if (a != b)
|
||||||
{
|
{
|
||||||
printf("failed startup seed at test %d. rand()=%d reference=%d\n",j,a,b);
|
printf("failed startup seed at test %d. rand()=%d reference=%d\n",j,a,b);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test every power of 2 seed */
|
/* test every power of 2 seed */
|
||||||
for (i = 0; i < 16; ++i)
|
for (i = 0; i < 16; ++i)
|
||||||
{
|
{
|
||||||
srand(1<<i);
|
srand(1<<i);
|
||||||
ref_srand(1<<i);
|
ref_srand(1<<i);
|
||||||
for (j=0; j<SUBTESTS; ++j)
|
for (j=0; j<SUBTESTS; ++j)
|
||||||
{
|
{
|
||||||
a = rand();
|
a = rand();
|
||||||
b = ref_rand();
|
b = ref_rand();
|
||||||
if (a != b)
|
if (a != b)
|
||||||
{
|
{
|
||||||
printf("failed seed %d at test %d. rand()=%d reference=%d\n",(1<<i),j,a,b);
|
printf("failed seed %d at test %d. rand()=%d reference=%d\n",(1<<i),j,a,b);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test a sampling of seeds*/
|
/* test a sampling of seeds*/
|
||||||
for (i = 0; i < 32768UL; i += TESTINC)
|
for (i = 0; i < 32768UL; i += TESTINC)
|
||||||
{
|
{
|
||||||
srand(i);
|
srand(i);
|
||||||
ref_srand(i);
|
ref_srand(i);
|
||||||
for (j=0; j<SUBTESTS; ++j)
|
for (j=0; j<SUBTESTS; ++j)
|
||||||
{
|
{
|
||||||
a = rand();
|
a = rand();
|
||||||
b = ref_rand();
|
b = ref_rand();
|
||||||
if (a != b)
|
if (a != b)
|
||||||
{
|
{
|
||||||
printf("failed seed %d at test %d. rand()=%d reference=%d\n",(1<<i),j,a,b);
|
printf("failed seed %d at test %d. rand()=%d reference=%d\n",(1<<i),j,a,b);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user