24
24
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
25
25
* Portions Copyright (c) 1994, Regents of the University of California
26
26
*
27
- * $PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.51 2010/01/02 16:57:45 momjian Exp $
27
+ * $PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.52 2010/01/07 04:53:34 tgl Exp $
28
28
*
29
29
*-------------------------------------------------------------------------
30
30
*/
@@ -272,12 +272,7 @@ pq_sendint64(StringInfo buf, int64 i)
272
272
uint32 n32 ;
273
273
274
274
/* High order half first, since we're doing MSB-first */
275
- #ifdef INT64_IS_BUSTED
276
- /* don't try a right shift of 32 on a 32-bit word */
277
- n32 = (i < 0 ) ? -1 : 0 ;
278
- #else
279
275
n32 = (uint32 ) (i >> 32 );
280
- #endif
281
276
n32 = htonl (n32 );
282
277
appendBinaryStringInfo (buf , (char * ) & n32 , 4 );
283
278
@@ -327,27 +322,6 @@ pq_sendfloat4(StringInfo buf, float4 f)
327
322
void
328
323
pq_sendfloat8 (StringInfo buf , float8 f )
329
324
{
330
- #ifdef INT64_IS_BUSTED
331
- union
332
- {
333
- float8 f ;
334
- uint32 h [2 ];
335
- } swap ;
336
-
337
- swap .f = f ;
338
- swap .h [0 ] = htonl (swap .h [0 ]);
339
- swap .h [1 ] = htonl (swap .h [1 ]);
340
-
341
- #ifdef WORDS_BIGENDIAN
342
- /* machine seems to be big-endian, send h[0] first */
343
- appendBinaryStringInfo (buf , (char * ) & swap .h [0 ], 4 );
344
- appendBinaryStringInfo (buf , (char * ) & swap .h [1 ], 4 );
345
- #else
346
- /* machine seems to be little-endian, send h[1] first */
347
- appendBinaryStringInfo (buf , (char * ) & swap .h [1 ], 4 );
348
- appendBinaryStringInfo (buf , (char * ) & swap .h [0 ], 4 );
349
- #endif
350
- #else /* INT64 works */
351
325
union
352
326
{
353
327
float8 f ;
@@ -356,7 +330,6 @@ pq_sendfloat8(StringInfo buf, float8 f)
356
330
357
331
swap .f = f ;
358
332
pq_sendint64 (buf , swap .i );
359
- #endif
360
333
}
361
334
362
335
/* --------------------------------
@@ -520,18 +493,9 @@ pq_getmsgint64(StringInfo msg)
520
493
h32 = ntohl (h32 );
521
494
l32 = ntohl (l32 );
522
495
523
- #ifdef INT64_IS_BUSTED
524
- /* error out if incoming value is wider than 32 bits */
525
- result = l32 ;
526
- if ((result < 0 ) ? (h32 != -1 ) : (h32 != 0 ))
527
- ereport (ERROR ,
528
- (errcode (ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE ),
529
- errmsg ("binary value is out of range for type bigint" )));
530
- #else
531
496
result = h32 ;
532
497
result <<= 32 ;
533
498
result |= l32 ;
534
- #endif
535
499
536
500
return result ;
537
501
}
@@ -564,24 +528,6 @@ pq_getmsgfloat4(StringInfo msg)
564
528
float8
565
529
pq_getmsgfloat8 (StringInfo msg )
566
530
{
567
- #ifdef INT64_IS_BUSTED
568
- union
569
- {
570
- float8 f ;
571
- uint32 h [2 ];
572
- } swap ;
573
-
574
- #ifdef WORDS_BIGENDIAN
575
- /* machine seems to be big-endian, receive h[0] first */
576
- swap .h [0 ] = pq_getmsgint (msg , 4 );
577
- swap .h [1 ] = pq_getmsgint (msg , 4 );
578
- #else
579
- /* machine seems to be little-endian, receive h[1] first */
580
- swap .h [1 ] = pq_getmsgint (msg , 4 );
581
- swap .h [0 ] = pq_getmsgint (msg , 4 );
582
- #endif
583
- return swap .f ;
584
- #else /* INT64 works */
585
531
union
586
532
{
587
533
float8 f ;
@@ -590,7 +536,6 @@ pq_getmsgfloat8(StringInfo msg)
590
536
591
537
swap .i = pq_getmsgint64 (msg );
592
538
return swap .f ;
593
- #endif
594
539
}
595
540
596
541
/* --------------------------------
0 commit comments