1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Document where we want a uint16_t instead of a uint64_t

This patch removes some conversion warnings and
better describe where we are going to expect a
small integer.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2008-09-18 09:53:14 +01:00
parent a0aa8e760a
commit 94929c36bd

View file

@ -340,7 +340,7 @@ namespace {
uint64_t book_color_key(const Position &pos);
uint64_t read_integer(FILE *file, int size);
uint16_t read_small_integer(FILE *file, int size);
}
@ -485,10 +485,10 @@ void Book::read_entry(BookEntry& entry, int n) const {
}
entry.key = read_integer(bookFile, 8);
entry.move = read_integer(bookFile, 2);
entry.count = read_integer(bookFile, 2);
entry.n = read_integer(bookFile, 2);
entry.sum = read_integer(bookFile, 2);
entry.move = read_small_integer(bookFile, 2);
entry.count = read_small_integer(bookFile, 2);
entry.n = read_small_integer(bookFile, 2);
entry.sum = read_small_integer(bookFile, 2);
}
@ -555,7 +555,7 @@ namespace {
uint64_t read_integer(FILE *file, int size) {
uint64_t n = 0ULL;;
uint64_t n = 0ULL;
int i;
int b;
@ -575,4 +575,12 @@ namespace {
return n;
}
uint16_t read_small_integer(FILE *file, int size) {
assert(size > 0 && size <= 5); // 16 bit integer
uint64_t n = read_integer(file, size);
assert(n == (uint16_t)n);
return (uint16_t)n;
}
}