working on the block expression compilation
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
static int fmt_uintmax (
|
||||
char_t* buf, int size,
|
||||
char_t* buf, int size,
|
||||
hcl_uintmax_t value, int base_and_flags, int prec,
|
||||
char_t fillchar, char_t signchar, const char_t* prefix)
|
||||
{
|
||||
@ -41,10 +41,10 @@ static int fmt_uintmax (
|
||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ":
|
||||
"0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
if ((base_and_flags & HCL_FMT_INTMAX_NOZERO) && value == 0)
|
||||
if ((base_and_flags & HCL_FMT_INTMAX_NOZERO) && value == 0)
|
||||
{
|
||||
p = tmp;
|
||||
if (base_and_flags & HCL_FMT_INTMAX_ZEROLEAD)
|
||||
p = tmp;
|
||||
if (base_and_flags & HCL_FMT_INTMAX_ZEROLEAD)
|
||||
{
|
||||
/* NOZERO emits no digit, ZEROLEAD emits 1 digit.
|
||||
* so it emits '0' */
|
||||
@ -63,7 +63,7 @@ static int fmt_uintmax (
|
||||
hcl_uintmax_t v = value;
|
||||
|
||||
/* store the resulting numeric string into 'tmp' first */
|
||||
p = tmp;
|
||||
p = tmp;
|
||||
do
|
||||
{
|
||||
*p++ = xbasestr[v % base];
|
||||
@ -73,11 +73,11 @@ static int fmt_uintmax (
|
||||
|
||||
/* reslen is the length of the resulting string without padding. */
|
||||
reslen = (int)(p - tmp);
|
||||
|
||||
|
||||
/* precision specified the minum number of digits to produce.
|
||||
* so if the precision is larger that the digits produced,
|
||||
* so if the precision is larger that the digits produced,
|
||||
* reslen should be adjusted to precision */
|
||||
if (prec > reslen)
|
||||
if (prec > reslen)
|
||||
{
|
||||
/* if the precision is greater than the actual digits
|
||||
* made from the value, 0 is inserted in front.
|
||||
@ -86,12 +86,12 @@ static int fmt_uintmax (
|
||||
preczero = prec - reslen;
|
||||
reslen = prec;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
preczero = 0;
|
||||
if ((base_and_flags & HCL_FMT_INTMAX_ZEROLEAD) && value != 0)
|
||||
if ((base_and_flags & HCL_FMT_INTMAX_ZEROLEAD) && value != 0)
|
||||
{
|
||||
/* if value is zero, 0 is emitted from it.
|
||||
/* if value is zero, 0 is emitted from it.
|
||||
* so ZEROLEAD don't need to add another 0. */
|
||||
preczero++;
|
||||
reslen++;
|
||||
@ -137,10 +137,10 @@ static int fmt_uintmax (
|
||||
if (prefix) while (*prefix && bp < be) *bp++ = *prefix++;
|
||||
|
||||
/* add 0s for precision */
|
||||
while (preczero > 0 && bp < be)
|
||||
{
|
||||
while (preczero > 0 && bp < be)
|
||||
{
|
||||
*bp++ = '0';
|
||||
preczero--;
|
||||
preczero--;
|
||||
}
|
||||
|
||||
/* copy the numeric string to the destination buffer */
|
||||
@ -169,10 +169,10 @@ static int fmt_uintmax (
|
||||
if (prefix) while (*prefix && bp < be) *bp++ = *prefix++;
|
||||
|
||||
/* add 0s for precision */
|
||||
while (preczero > 0 && bp < be)
|
||||
{
|
||||
while (preczero > 0 && bp < be)
|
||||
{
|
||||
*bp++ = '0';
|
||||
preczero--;
|
||||
preczero--;
|
||||
}
|
||||
|
||||
/* copy the numeric string to the destination buffer */
|
||||
@ -194,10 +194,10 @@ static int fmt_uintmax (
|
||||
if (prefix) while (*prefix && bp < be) *bp++ = *prefix++;
|
||||
|
||||
/* add 0s for precision */
|
||||
while (preczero > 0 && bp < be)
|
||||
{
|
||||
while (preczero > 0 && bp < be)
|
||||
{
|
||||
*bp++ = '0';
|
||||
preczero--;
|
||||
preczero--;
|
||||
}
|
||||
|
||||
/* copy the numeric string to the destination buffer */
|
||||
@ -213,10 +213,10 @@ static int fmt_uintmax (
|
||||
if (prefix) while (*prefix && bp < be) *bp++ = *prefix++;
|
||||
|
||||
/* add 0s for precision */
|
||||
while (preczero > 0 && bp < be)
|
||||
{
|
||||
while (preczero > 0 && bp < be)
|
||||
{
|
||||
*bp++ = '0';
|
||||
preczero--;
|
||||
preczero--;
|
||||
}
|
||||
|
||||
/* copy the numeric string to the destination buffer */
|
||||
|
Reference in New Issue
Block a user