From: Peter Johnson Date: Mon, 15 Oct 2001 04:34:11 +0000 (-0000) Subject: Change order of arguments for get_ and check_ functions to better match other X-Git-Tag: v0.1.0~249 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a83fc9c8f66c60dfad8920a1a71e50c2ed99184f;p=yasm Change order of arguments for get_ and check_ functions to better match other functions (floatnum * as first arg). svn path=/trunk/yasm/; revision=281 --- diff --git a/libyasm/floatnum.c b/libyasm/floatnum.c index e251cfb3..103e569e 100644 --- a/libyasm/floatnum.c +++ b/libyasm/floatnum.c @@ -494,11 +494,11 @@ floatnum_calc(floatnum *acc, ExprOp op, floatnum *operand) } int -floatnum_get_int(unsigned long *ret_val, const floatnum *flt) +floatnum_get_int(const floatnum *flt, unsigned long *ret_val) { unsigned char t[4]; - if (floatnum_get_sized(t, flt, 4)) + if (floatnum_get_sized(flt, t, 4)) return 1; LOAD_LONG(*ret_val, &t[0]); @@ -517,7 +517,7 @@ floatnum_get_int(unsigned long *ret_val, const floatnum *flt) * Returns 0 on success, 1 if overflow, -1 if underflow. */ static int -floatnum_get_common(unsigned char *ptr, const floatnum *flt, int byte_size, +floatnum_get_common(const floatnum *flt, unsigned char *ptr, int byte_size, int mant_bits, int implicit1, int exp_bits) { int exponent = flt->exponent; @@ -626,15 +626,15 @@ floatnum_get_common(unsigned char *ptr, const floatnum *flt, int byte_size, * s = sign (for mantissa) */ int -floatnum_get_sized(unsigned char *ptr, const floatnum *flt, size_t size) +floatnum_get_sized(const floatnum *flt, unsigned char *ptr, size_t size) { switch (size) { case 4: - return floatnum_get_common(ptr, flt, 4, 23, 1, 8); + return floatnum_get_common(flt, ptr, 4, 23, 1, 8); case 8: - return floatnum_get_common(ptr, flt, 8, 52, 1, 11); + return floatnum_get_common(flt, ptr, 8, 52, 1, 11); case 10: - return floatnum_get_common(ptr, flt, 10, 64, 0, 15); + return floatnum_get_common(flt, ptr, 10, 64, 0, 15); default: InternalError(__LINE__, __FILE__, _("Invalid float conversion size")); @@ -669,19 +669,19 @@ floatnum_print(const floatnum *flt) free(str); /* 32-bit (single precision) format */ - printf("32-bit: %d: ", floatnum_get_sized(out, flt, 4)); + printf("32-bit: %d: ", floatnum_get_sized(flt, out, 4)); for (i=0; i<4; i++) printf("%02x ", out[i]); printf("\n"); /* 64-bit (double precision) format */ - printf("64-bit: %d: ", floatnum_get_sized(out, flt, 8)); + printf("64-bit: %d: ", floatnum_get_sized(flt, out, 8)); for (i=0; i<8; i++) printf("%02x ", out[i]); printf("\n"); /* 80-bit (extended precision) format */ - printf("80-bit: %d: ", floatnum_get_sized(out, flt, 10)); + printf("80-bit: %d: ", floatnum_get_sized(flt, out, 10)); for (i=0; i<10; i++) printf("%02x ", out[i]); printf("\n"); diff --git a/libyasm/floatnum.h b/libyasm/floatnum.h index 4963e79a..1e138951 100644 --- a/libyasm/floatnum.h +++ b/libyasm/floatnum.h @@ -72,12 +72,12 @@ void floatnum_calc(floatnum *acc, ExprOp op, floatnum *operand); /* Essentially a convert to single-precision and return as 32-bit value. * The 32-bit value is a "standard" C value (eg, of unknown endian). */ -int floatnum_get_int(unsigned long *ret_val, const floatnum *flt); +int floatnum_get_int(const floatnum *flt, unsigned long *ret_val); /* ptr will point to the Intel-format little-endian byte string after a * successful call (eg, [0] should be the first byte output to the file). */ -int floatnum_get_sized(unsigned char *ptr, const floatnum *flt, size_t size); +int floatnum_get_sized(const floatnum *flt, unsigned char *ptr, size_t size); /* Basic check to see if size is even valid for flt conversion (doesn't * actually check for underflow/overflow but rather checks for size=4,8,10). diff --git a/libyasm/tests/floatnum_test.c b/libyasm/tests/floatnum_test.c index 78ef88e8..84a4bdad 100644 --- a/libyasm/tests/floatnum_test.c +++ b/libyasm/tests/floatnum_test.c @@ -287,7 +287,7 @@ START_TEST(test_get_single_normalized) for (i=0; iexponent; @@ -626,15 +626,15 @@ floatnum_get_common(unsigned char *ptr, const floatnum *flt, int byte_size, * s = sign (for mantissa) */ int -floatnum_get_sized(unsigned char *ptr, const floatnum *flt, size_t size) +floatnum_get_sized(const floatnum *flt, unsigned char *ptr, size_t size) { switch (size) { case 4: - return floatnum_get_common(ptr, flt, 4, 23, 1, 8); + return floatnum_get_common(flt, ptr, 4, 23, 1, 8); case 8: - return floatnum_get_common(ptr, flt, 8, 52, 1, 11); + return floatnum_get_common(flt, ptr, 8, 52, 1, 11); case 10: - return floatnum_get_common(ptr, flt, 10, 64, 0, 15); + return floatnum_get_common(flt, ptr, 10, 64, 0, 15); default: InternalError(__LINE__, __FILE__, _("Invalid float conversion size")); @@ -669,19 +669,19 @@ floatnum_print(const floatnum *flt) free(str); /* 32-bit (single precision) format */ - printf("32-bit: %d: ", floatnum_get_sized(out, flt, 4)); + printf("32-bit: %d: ", floatnum_get_sized(flt, out, 4)); for (i=0; i<4; i++) printf("%02x ", out[i]); printf("\n"); /* 64-bit (double precision) format */ - printf("64-bit: %d: ", floatnum_get_sized(out, flt, 8)); + printf("64-bit: %d: ", floatnum_get_sized(flt, out, 8)); for (i=0; i<8; i++) printf("%02x ", out[i]); printf("\n"); /* 80-bit (extended precision) format */ - printf("80-bit: %d: ", floatnum_get_sized(out, flt, 10)); + printf("80-bit: %d: ", floatnum_get_sized(flt, out, 10)); for (i=0; i<10; i++) printf("%02x ", out[i]); printf("\n"); diff --git a/src/floatnum.h b/src/floatnum.h index 4963e79a..1e138951 100644 --- a/src/floatnum.h +++ b/src/floatnum.h @@ -72,12 +72,12 @@ void floatnum_calc(floatnum *acc, ExprOp op, floatnum *operand); /* Essentially a convert to single-precision and return as 32-bit value. * The 32-bit value is a "standard" C value (eg, of unknown endian). */ -int floatnum_get_int(unsigned long *ret_val, const floatnum *flt); +int floatnum_get_int(const floatnum *flt, unsigned long *ret_val); /* ptr will point to the Intel-format little-endian byte string after a * successful call (eg, [0] should be the first byte output to the file). */ -int floatnum_get_sized(unsigned char *ptr, const floatnum *flt, size_t size); +int floatnum_get_sized(const floatnum *flt, unsigned char *ptr, size_t size); /* Basic check to see if size is even valid for flt conversion (doesn't * actually check for underflow/overflow but rather checks for size=4,8,10). diff --git a/src/tests/floatnum_test.c b/src/tests/floatnum_test.c index 78ef88e8..84a4bdad 100644 --- a/src/tests/floatnum_test.c +++ b/src/tests/floatnum_test.c @@ -287,7 +287,7 @@ START_TEST(test_get_single_normalized) for (i=0; i