File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -545,6 +545,26 @@ RTM_EXPORT(rt_show_version);
545545/* private function */
546546#define isdigit (c ) ((unsigned)((c) - '0') < 10)
547547
548+ #ifdef RT_PRINTF_LONGLONG
549+ rt_inline int divide (long long * n , int base )
550+ {
551+ int res ;
552+
553+ /* optimized for processor which does not support divide instructions. */
554+ if (base == 10 )
555+ {
556+ res = (int )(((unsigned long long )* n ) % 10U );
557+ * n = (long long )(((unsigned long long )* n ) / 10U );
558+ }
559+ else
560+ {
561+ res = (int )(((unsigned long long )* n ) % 16U );
562+ * n = (long long )(((unsigned long long )* n ) / 16U );
563+ }
564+
565+ return res ;
566+ }
567+ #else
548568rt_inline int divide (long * n , int base )
549569{
550570 int res ;
@@ -563,6 +583,7 @@ rt_inline int divide(long *n, int base)
563583
564584 return res ;
565585}
586+ #endif
566587
567588rt_inline int skip_atoi (const char * * s )
568589{
@@ -584,15 +605,23 @@ rt_inline int skip_atoi(const char **s)
584605#ifdef RT_PRINTF_PRECISION
585606static char * print_number (char * buf ,
586607 char * end ,
608+ #ifdef RT_PRINTF_LONGLONG
609+ long long num ,
610+ #else
587611 long num ,
612+ #endif
588613 int base ,
589614 int s ,
590615 int precision ,
591616 int type )
592617#else
593618static char * print_number (char * buf ,
594619 char * end ,
620+ #ifdef RT_PRINTF_LONGLONG
621+ long long num ,
622+ #else
595623 long num ,
624+ #endif
596625 int base ,
597626 int s ,
598627 int type )
You can’t perform that action at this time.
0 commit comments