Skip to content
Snippets Groups Projects
Commit 0b510ad9 authored by Tom Lane's avatar Tom Lane
Browse files

Fix unportable (and incorrect anyway) usage of LL constant suffix that

recently snuck into cash.c.  Per report from Edmundo Robles Lopez.
parent 242d70d5
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@
* this version handles 64 bit numbers and so can hold values up to
* $92,233,720,368,547,758.07.
*
* $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.79 2008/04/21 00:26:45 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.80 2008/06/09 19:58:39 tgl Exp $
*/
#include "postgres.h"
......@@ -794,13 +794,13 @@ cash_words(PG_FUNCTION_ARGS)
/* Now treat as unsigned, to avoid trouble at INT_MIN */
val = (uint64) value;
m0 = val % 100ll; /* cents */
m1 = (val / 100ll) % 1000; /* hundreds */
m2 = (val / 100000ll) % 1000; /* thousands */
m3 = val / 100000000ll % 1000; /* millions */
m4 = val / 100000000000ll % 1000; /* billions */
m5 = val / 100000000000000ll % 1000; /* trillions */
m6 = val / 100000000000000000ll % 1000; /* quadrillions */
m0 = val % INT64CONST(100); /* cents */
m1 = (val / INT64CONST(100)) % 1000; /* hundreds */
m2 = (val / INT64CONST(100000)) % 1000; /* thousands */
m3 = (val / INT64CONST(100000000)) % 1000; /* millions */
m4 = (val / INT64CONST(100000000000)) % 1000; /* billions */
m5 = (val / INT64CONST(100000000000000)) % 1000; /* trillions */
m6 = (val / INT64CONST(100000000000000000)) % 1000; /* quadrillions */
if (m6)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment