/****************************************************************12The author of this software is David M. Gay.34Copyright (C) 1998, 2000 by Lucent Technologies5All Rights Reserved67Permission to use, copy, modify, and distribute this software and8its documentation for any purpose and without fee is hereby9granted, provided that the above copyright notice appear in all10copies and that both that the copyright notice and this11permission notice and warranty disclaimer appear in supporting12documentation, and that the name of Lucent or any of its entities13not be used in advertising or publicity pertaining to14distribution of the software without specific, written prior15permission.1617LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,18INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.19IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY20SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES21WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER22IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,23ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF24THIS SOFTWARE.2526****************************************************************/2728/* Please send bug reports to David M. Gay (dmg at acm dot org,29* with " at " changed at "@" and " dot " changed to "."). */3031#include "gdtoaimp.h"3233#undef _034#undef _13536/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */3738#ifdef IEEE_MC68k39#define _0 040#define _1 141#define _2 242#endif43#ifdef IEEE_808744#define _0 245#define _1 146#define _2 047#endif4849int50#ifdef KR_headers51strtopxL(s, sp, V) CONST char *s; char **sp; void *V;52#else53strtopxL(CONST char *s, char **sp, void *V)54#endif55{56static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI };57ULong bits[2];58Long exp;59int k;60ULong *L = (ULong*)V;61#ifdef Honor_FLT_ROUNDS62#include "gdtoa_fltrnds.h"63#else64#define fpi &fpi065#endif6667k = strtodg(s, sp, fpi, &exp, bits);68switch(k & STRTOG_Retmask) {69case STRTOG_NoNumber:70case STRTOG_Zero:71L[0] = L[1] = L[2] = 0;72break;7374case STRTOG_Normal:75case STRTOG_Denormal:76case STRTOG_NaNbits:77L[_2] = bits[0];78L[_1] = bits[1];79L[_0] = (exp + 0x3fff + 63) << 16;80break;8182case STRTOG_Infinite:83L[_0] = 0x7fff << 16;84L[_1] = 0x80000000;85L[_2] = 0;86break;8788case STRTOG_NaN:89L[0] = ld_QNAN0;90L[1] = ld_QNAN1;91L[2] = ld_QNAN2;92}93if (k & STRTOG_Neg)94L[_0] |= 0x80000000L;95return k;96}979899