Made maximum rows more limited to avoid bugs
This commit is contained in:
parent
214112ad17
commit
72a56a15d7
2 changed files with 7 additions and 7 deletions
|
|
@ -114,7 +114,7 @@ int main( int argc, char *argv[] ){
|
||||||
"\n"
|
"\n"
|
||||||
" -o file --output file Ouput moves taken in game to file\n"
|
" -o file --output file Ouput moves taken in game to file\n"
|
||||||
"\n"
|
"\n"
|
||||||
" --slow-calcwins Use the 32bit reference implementation of calcWins()\n"
|
" --slow-calcwins Use the reference implementation of calcWins()\n"
|
||||||
" --random-moves Play random moves instead of asking for input\n"
|
" --random-moves Play random moves instead of asking for input\n"
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -150,7 +150,7 @@ int main( int argc, char *argv[] ){
|
||||||
fprintf( stderr, "ERR: AMOUT OF ROWS MUST BE AT LEAST 1\n" );
|
fprintf( stderr, "ERR: AMOUT OF ROWS MUST BE AT LEAST 1\n" );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#define ROWOVERFLOW (rowsint_t)( sizeof(column_t) * CHAR_BIT )
|
#define ROWOVERFLOW (rowsint_t)( sizeof(column_t) * CHAR_BIT - 1 )
|
||||||
if( playboard.rows >= ROWOVERFLOW ){
|
if( playboard.rows >= ROWOVERFLOW ){
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"ERR: AMOUT OF ROWS MUST BE LESS THAN %d\n", ROWOVERFLOW
|
"ERR: AMOUT OF ROWS MUST BE LESS THAN %d\n", ROWOVERFLOW
|
||||||
|
|
|
||||||
4
types.h
4
types.h
|
|
@ -5,13 +5,13 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
// Use fastest available ints unless it's 64 bits because that uses more memory
|
// Use fastest available ints unless it's 64 bits because that is doing silly
|
||||||
#if INT_FAST16_MAX == INT_FAST64_MAX
|
#if INT_FAST16_MAX == INT_FAST64_MAX
|
||||||
typedef int rowsint_t;
|
typedef int rowsint_t;
|
||||||
typedef unsigned columnsint_t;
|
typedef unsigned columnsint_t;
|
||||||
#define QUITCOLUMN UINT_MAX
|
#define QUITCOLUMN UINT_MAX
|
||||||
typedef unsigned winint_t;
|
typedef unsigned winint_t;
|
||||||
typedef uintmax_t column_t;
|
typedef unsigned column_t;
|
||||||
#else
|
#else
|
||||||
typedef int_fast8_t rowsint_t;
|
typedef int_fast8_t rowsint_t;
|
||||||
typedef uint_fast8_t columnsint_t;
|
typedef uint_fast8_t columnsint_t;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue