From b6806c7f27bb0b901aca5c920daf6321e39c7dcd Mon Sep 17 00:00:00 2001 From: "graehl@gmail.com" Date: Sun, 15 Aug 2010 04:08:59 +0000 Subject: cfg test git-svn-id: https://ws10smt.googlecode.com/svn/trunk@552 ec762483-ff6d-05da-a07a-a48fb63a330f --- utils/ftoa.h | 1 + utils/utoa.h | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'utils') diff --git a/utils/ftoa.h b/utils/ftoa.h index 81a685ac..3dba528d 100755 --- a/utils/ftoa.h +++ b/utils/ftoa.h @@ -243,6 +243,7 @@ char *prepend_pos_nonsci(char *p,F f) { *--p='0'; } else p=utoa(p,u); + return p; } // modify p; return true if handled diff --git a/utils/utoa.h b/utils/utoa.h index 341965cc..5de490ba 100755 --- a/utils/utoa.h +++ b/utils/utoa.h @@ -136,6 +136,9 @@ char *utoa_drop_trailing_0(char *buf,Uint_ n_, unsigned &n_skipped) { } } +//#include "warning_push.h" +//#pragma GCC diagnostic ignore "-Wtype-limits" // because sign check on itoa is annoying + // desired feature: itoa(unsigned) = utoa(unsigned) // positive sign: 0 -> +0, 1-> +1. obviously -n -> -n template @@ -167,21 +170,23 @@ char * itoa_left_pad(char *buf,char *bufend,Int i,bool positive_sign=false,char } template -inline std::string itos(Int n) { +inline std::string utos(Int n) { char buf[signed_for_int::toa_bufsize]; char *end=buf+signed_for_int::toa_bufsize; - char *p=itoa(end,n); + char *p=utoa(end,n); return std::string(p,end); } template -inline std::string utos(Int n) { +inline std::string itos(Int n) { char buf[signed_for_int::toa_bufsize]; char *end=buf+signed_for_int::toa_bufsize; char *p=itoa(end,n); return std::string(p,end); } +//#include "warning_pop.h" + //returns position of '\0' terminating number written starting at to template inline char* append_utoa(char *to,typename signed_for_int::unsigned_t n) { -- cgit v1.2.3