Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define CC_CHAR_IS_DELIMITER(c) ((c)<=' ')
- int ccStrParseInt64( char *str, int64_t *retint )
- {
- int negflag;
- char c;
- int64_t workint;
- *retint = 0;
- if( !str )
- return 0;
- negflag = 0;
- if( *str == '-' )
- negflag = 1;
- str += negflag;
- workint = 0;
- for( ; ; str++ )
- {
- c = *str;
- if( ( c >= '0' ) && ( c <= '9' ) )
- {
- if( workint >= (int64_t)0xcccccccccccccccLL )
- return 0;
- workint = ( workint * 10 ) + ( c - '0' );
- }
- else if( CC_CHAR_IS_DELIMITER( c ) )
- break;
- else
- return 0;
- }
- if( negflag )
- workint = -workint;
- *retint = workint;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement