~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to strings/my_strtoll10.c

  • Committer: Brian Aker
  • Date: 2008-07-13 22:21:51 UTC
  • Revision ID: brian@tangent.org-20080713222151-fv2tcpbsc829j2oc
Ulonglong to uint64_t

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
  properly handle a constant expression containing a mod operator
24
24
*/
25
25
#if defined(__NETWARE__) && defined(__MWERKS__) 
26
 
static ulonglong ulonglong_max= ~(ulonglong) 0;
27
 
#define ULONGLONG_MAX ulonglong_max
 
26
static uint64_t uint64_t_max= ~(uint64_t) 0;
 
27
#define ULONGLONG_MAX uint64_t_max
28
28
#else
29
 
#define ULONGLONG_MAX           (~(ulonglong) 0)
 
29
#define ULONGLONG_MAX           (~(uint64_t) 0)
30
30
#endif /* __NETWARE__ && __MWERKS__ */
31
 
#define MAX_NEGATIVE_NUMBER     ((ulonglong) 0x8000000000000000LL)
 
31
#define MAX_NEGATIVE_NUMBER     ((uint64_t) 0x8000000000000000LL)
32
32
#define INIT_CNT  9
33
33
#define LFACTOR   1000000000ULL
34
34
#define LFACTOR1  10000000000ULL
88
88
  char *dummy;
89
89
  uchar c;
90
90
  unsigned long i, j, k;
91
 
  ulonglong li;
 
91
  uint64_t li;
92
92
  int negative;
93
93
  ulong cutoff, cutoff2, cutoff3;
94
94
 
207
207
  if (i > cutoff || (i == cutoff && ((j > cutoff2 || j == cutoff2) &&
208
208
                                     k > cutoff3)))
209
209
    goto overflow;
210
 
  li=i*LFACTOR2+ (ulonglong) j*100 + k;
 
210
  li=i*LFACTOR2+ (uint64_t) j*100 + k;
211
211
  return (longlong) li;
212
212
 
213
213
overflow:                                       /* *endptr is set here */
219
219
  return (negative ? ((longlong) -(long) i) : (longlong) i);
220
220
 
221
221
end_i_and_j:
222
 
  li= (ulonglong) i * lfactor[(uint) (s-start)] + j;
 
222
  li= (uint64_t) i * lfactor[(uint) (s-start)] + j;
223
223
  *endptr= (char*) s;
224
224
  return (negative ? -((longlong) li) : (longlong) li);
225
225
 
226
226
end3:
227
 
  li=(ulonglong) i*LFACTOR+ (ulonglong) j;
 
227
  li=(uint64_t) i*LFACTOR+ (uint64_t) j;
228
228
  *endptr= (char*) s;
229
229
  return (negative ? -((longlong) li) : (longlong) li);
230
230
 
231
231
end4:
232
 
  li=(ulonglong) i*LFACTOR1+ (ulonglong) j * 10 + k;
 
232
  li=(uint64_t) i*LFACTOR1+ (uint64_t) j * 10 + k;
233
233
  *endptr= (char*) s;
234
234
  if (negative)
235
235
  {