MCPcopy Create free account
hub / github.com/WheretIB/nullc / IntToStr

Method IntToStr

NULLC/StdLib.cpp:691–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689}
690
691NULLCArray NULLC::IntToStr(int* r)
692{
693 int number = *r;
694 bool sign = 0;
695 char buf[16];
696 char *curr = buf;
697 if(number < 0)
698 sign = 1;
699
700 *curr++ = (char)(abs(number % 10) + '0');
701 while(number /= 10)
702 *curr++ = (char)(abs(number % 10) + '0');
703 if(sign)
704 *curr++ = '-';
705 NULLCArray arr = AllocArray(1, (int)(curr - buf) + 1);
706 char *str = arr.ptr;
707 do
708 {
709 --curr;
710 *str++ = *curr;
711 }while(curr != buf);
712 return arr;
713}
714
715NULLCArray NULLC::DoubleToStr(int precision, double* r)
716{

Callers

nothing calls this directly

Calls 1

absFunction · 0.50

Tested by

no test coverage detected