~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mystrings/dtoa.cc

  • Committer: Stewart Smith
  • Date: 2009-03-16 04:30:37 UTC
  • mto: (942.1.10 mordred)
  • mto: This revision was merged to the branch mainline in revision 940.
  • Revision ID: stewart@flamingspork.com-20090316043037-49o18uthnlqwzqnc
more alignment fixes in dtoa memory allocation for SPARC64

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
{
89
89
  int decpt, sign, len, i;
90
90
  char *res, *src, *end, *dst= to;
91
 
  char buf[DTOA_BUFF_SIZE];
 
91
  double alignedbuf[(DTOA_BUFF_SIZE+1)/sizeof(double)];
 
92
  char *buf= (char*)alignedbuf;
92
93
  assert(precision >= 0 && precision < NOT_FIXED_DEC && to != NULL);
93
94
 
94
95
  res= dtoa(x, 5, precision, &decpt, &sign, &end, buf, sizeof(buf));
212
213
{
213
214
  int decpt, sign, len, exp_len;
214
215
  char *res, *src, *end, *dst= to, *dend= dst + width;
215
 
  char buf[DTOA_BUFF_SIZE];
 
216
  double alignedbuf[(DTOA_BUFF_SIZE+1)/sizeof(double)];
 
217
  char *buf= (char*)alignedbuf;
216
218
  bool have_space, force_e_format;
217
219
  assert(width > 0 && to != NULL);
218
220
 
458
460
 
459
461
double my_strtod(const char *str, char **end, int *error)
460
462
{
461
 
  char buf[DTOA_BUFF_SIZE];
 
463
  double alignedbuf[(DTOA_BUFF_SIZE+1)/sizeof(double)];
 
464
  char *buf= (char*)alignedbuf;
462
465
  double res;
463
466
  assert(str != NULL && end != NULL && *end != NULL && error != NULL);
464
467
 
646
649
    int x, len;
647
650
 
648
651
    x= 1 << k;
649
 
    len= sizeof(Bigint) + x * sizeof(ULong);
 
652
    len= ALIGN_SIZE(sizeof(Bigint) + x * sizeof(ULong));
650
653
 
651
654
    if (alloc->free + len <= alloc->end)
652
655
    {