Skip to content

Commit

Permalink
kernel: reformat ConvertFloatLiteralEager
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Apr 17, 2018
1 parent ccbce93 commit 6f6131d
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/intrprtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1790,19 +1790,21 @@ void IntrLongIntExpr(Obj string)

static Obj CONVERT_FLOAT_LITERAL_EAGER;

static Obj ConvertFloatLiteralEager(Obj str) {
Char *chars = (Char *)CHARS_STRING(str);
UInt len = GET_LEN_STRING(str);
Char mark = '\0';
if (chars[len-1] == '_') {
SET_LEN_STRING(str, len-1);
chars[len-1] = '\0';
} else if (chars[len-2] == '_') {
mark = chars[len-1];
SET_LEN_STRING(str, len-2);
chars[len-2] = '\0';
}
return CALL_2ARGS(CONVERT_FLOAT_LITERAL_EAGER, str, ObjsChar[(UInt)mark]);
static Obj ConvertFloatLiteralEager(Obj str)
{
Char * chars = (Char *)CHARS_STRING(str);
UInt len = GET_LEN_STRING(str);
Char mark = '\0';
if (chars[len - 1] == '_') {
SET_LEN_STRING(str, len - 1);
chars[len - 1] = '\0';
}
else if (chars[len - 2] == '_') {
mark = chars[len - 1];
SET_LEN_STRING(str, len - 2);
chars[len - 2] = '\0';
}
return CALL_2ARGS(CONVERT_FLOAT_LITERAL_EAGER, str, ObjsChar[(UInt)mark]);
}

void IntrFloatExpr (
Expand Down

0 comments on commit 6f6131d

Please sign in to comment.