summaryrefslogtreecommitdiff
path: root/utils/utoa.h
diff options
context:
space:
mode:
authorgraehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-15 04:08:59 +0000
committergraehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-15 04:08:59 +0000
commit541915be79d90329f40381ef75c98c794ea0298c (patch)
tree197f5b99107d7487c39d5b46b8bc243c6a19cc2a /utils/utoa.h
parent695ee5c0b87365857925ecb53a45b97ba4582974 (diff)
cfg test
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@552 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'utils/utoa.h')
-rwxr-xr-xutils/utoa.h11
1 files changed, 8 insertions, 3 deletions
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<unsigned> is annoying
+
// desired feature: itoa(unsigned) = utoa(unsigned)
// positive sign: 0 -> +0, 1-> +1. obviously -n -> -n
template <class Int>
@@ -167,21 +170,23 @@ char * itoa_left_pad(char *buf,char *bufend,Int i,bool positive_sign=false,char
}
template <class Int>
-inline std::string itos(Int n) {
+inline std::string utos(Int n) {
char buf[signed_for_int<Int>::toa_bufsize];
char *end=buf+signed_for_int<Int>::toa_bufsize;
- char *p=itoa(end,n);
+ char *p=utoa(end,n);
return std::string(p,end);
}
template <class Int>
-inline std::string utos(Int n) {
+inline std::string itos(Int n) {
char buf[signed_for_int<Int>::toa_bufsize];
char *end=buf+signed_for_int<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 <class Int>
inline char* append_utoa(char *to,typename signed_for_int<Int>::unsigned_t n) {