From 847bfaa16c8a89f11911e1f27f5ad637b8f82723 Mon Sep 17 00:00:00 2001 From: graehl Date: Fri, 13 Aug 2010 03:30:49 +0000 Subject: named_enum, itoa, cdec replace --a-b=x with --a_b=x git-svn-id: https://ws10smt.googlecode.com/svn/trunk@536 ec762483-ff6d-05da-a07a-a48fb63a330f --- utils/static_utoa.h | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'utils/static_utoa.h') diff --git a/utils/static_utoa.h b/utils/static_utoa.h index 3af9fbb6..d15ed35b 100755 --- a/utils/static_utoa.h +++ b/utils/static_utoa.h @@ -5,35 +5,19 @@ #include "utoa.h" namespace { +static const int utoa_bufsize=40; // 64bit safe. +static const int utoa_bufsizem1=utoa_bufsize-1; // 64bit safe. THREADLOCAL char utoa_buf[utoa_bufsize]; // to put end of string character at buf[20] } inline char *static_utoa(unsigned n) { + assert(utoa_buf[utoa_bufsizem1]==0); return utoa(utoa_buf+utoa_bufsizem1,n); } inline char *static_itoa(int n) { + assert(utoa_buf[utoa_bufsizem1]==0); return itoa(utoa_buf+utoa_bufsizem1,n); } -#ifdef ITOA_SAMPLE -# include -# include -# include -using namespace std; - -int main(int argc,char *argv[]) { - printf("d U d U d U\n"); - for (int i=1;i