be more precise in long long int literal specification for ANSI compilers (gcc3 requires an LL suffix on literals that do not fit in an int

This commit is contained in:
Josh Coalson
2004-07-29 06:28:59 +00:00
parent 2af08da5e5
commit 49623ea2d0
7 changed files with 77 additions and 28 deletions

View File

@@ -21,6 +21,13 @@
#include <stdio.h>
#include <string.h> /* for memcmp() */
/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */
#ifdef _MSC_VER
#define FLAC__U64L(x) x
#else
#define FLAC__U64L(x) x##LLU
#endif
/*
* WATCHOUT! Since FLAC__BitBuffer is a private structure, we use a copy of
* the definition here to get at the internals. Make sure this is kept up
@@ -174,7 +181,7 @@ FLAC__bool test_bitbuffer()
FLAC__bitbuffer_write_zeroes(bb, 4) &&
FLAC__bitbuffer_write_raw_uint32(bb, 0x3, 2) &&
FLAC__bitbuffer_write_zeroes(bb, 8) &&
FLAC__bitbuffer_write_raw_uint64(bb, 0xaaaaaaaadeadbeef, 64) &&
FLAC__bitbuffer_write_raw_uint64(bb, FLAC__U64L(0xaaaaaaaadeadbeef), 64) &&
FLAC__bitbuffer_write_raw_uint32(bb, 0xace, 12)
;
if(!ok) {
@@ -674,7 +681,7 @@ FLAC__bool test_bitbuffer()
printf("testing utf8_uint64(0x0000000FFFFFFFFF)... ");
FLAC__bitbuffer_clear(bb);
FLAC__bitbuffer_write_utf8_uint64(bb, 0x0000000FFFFFFFFF);
FLAC__bitbuffer_write_utf8_uint64(bb, FLAC__U64L(0x0000000FFFFFFFFF));
ok = bb->total_bits == 56 && bb->buffer[0] == 0xFE && bb->buffer[1] == 0xBF && bb->buffer[2] == 0xBF && bb->buffer[3] == 0xBF && bb->buffer[4] == 0xBF && bb->buffer[5] == 0xBF && bb->buffer[6] == 0xBF;
printf("%s\n", ok?"OK":"FAILED");
if(!ok) {