2424 * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
2525 * Portions Copyright (c) 1994, Regents of the University of California
2626 *
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 $
2828 *
2929 *-------------------------------------------------------------------------
3030 */
@@ -272,12 +272,7 @@ pq_sendint64(StringInfo buf, int64 i)
272272 uint32 n32 ;
273273
274274 /* 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
279275 n32 = (uint32 ) (i >> 32 );
280- #endif
281276 n32 = htonl (n32 );
282277 appendBinaryStringInfo (buf , (char * ) & n32 , 4 );
283278
@@ -327,27 +322,6 @@ pq_sendfloat4(StringInfo buf, float4 f)
327322void
328323pq_sendfloat8 (StringInfo buf , float8 f )
329324{
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 */
351325 union
352326 {
353327 float8 f ;
@@ -356,7 +330,6 @@ pq_sendfloat8(StringInfo buf, float8 f)
356330
357331 swap .f = f ;
358332 pq_sendint64 (buf , swap .i );
359- #endif
360333}
361334
362335/* --------------------------------
@@ -520,18 +493,9 @@ pq_getmsgint64(StringInfo msg)
520493 h32 = ntohl (h32 );
521494 l32 = ntohl (l32 );
522495
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
531496 result = h32 ;
532497 result <<= 32 ;
533498 result |= l32 ;
534- #endif
535499
536500 return result ;
537501}
@@ -564,24 +528,6 @@ pq_getmsgfloat4(StringInfo msg)
564528float8
565529pq_getmsgfloat8 (StringInfo msg )
566530{
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 */
585531 union
586532 {
587533 float8 f ;
@@ -590,7 +536,6 @@ pq_getmsgfloat8(StringInfo msg)
590536
591537 swap .i = pq_getmsgint64 (msg );
592538 return swap .f ;
593- #endif
594539}
595540
596541/* --------------------------------
0 commit comments