Skip to content

Integer bit sizes are not respected #117

Open
@MaddyGuthridge

Description

Consider the following program:

/**
 * Convert a string to I64, finishing when a non-numeric character is
 * encountered.
 */
I64 StrToI64(U8 *str)
{
  I64 total = 0;
  for (I64 i = 0; str[i] >= '0' && str[i] <= '9'; i++)
  {
    total *= 10(I64);
    total += (str[i] - '0')(I64);
    "%u\n", total;
  }
  return total;
}

U0 Main()
{
    "5489811661987 | %u\n",StrToI64("5489811661987");
}

The values appear to be treated as an I32 instead of an I64.

⋙   hcc -o bin/number src/number.hc && ./bin/number
5
54
548
5489
54898
548981
5489811
54898116
548981166
1194844365
3358509067
3520319606
843457699
5489811661987 | 843457699

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions