Changeset 3576 in CLRX


Ignore:
Timestamp:
Jan 1, 2018, 9:46:14 AM (6 months ago)
Author:
matszpk
Message:

CLRadeonExtender: Asm: Improve fastExprEvaluate (handle unary '+' and '-' at any place of an expression).

Location:
CLRadeonExtender/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdasm/AsmExpression.cpp

    r3575 r3576  
    15911591    const char* tmpLinePtr = linePtr;
    15921592    skipSpacesToEnd(tmpLinePtr, end);
    1593     // check first operator '+' or '-'
    1594     if (tmpLinePtr!=end)
    1595     {
    1596         if (*tmpLinePtr=='+' || *tmpLinePtr=='-')
    1597         {
    1598             addition = (*tmpLinePtr=='+');
    1599             skipCharAndSpacesToEnd(tmpLinePtr, end);
    1600         }
    1601     }
    1602     else
    1603         return false;
    16041593   
    16051594    // main loop
    16061595    while (true)
    16071596    {
     1597        // loop for chain of unary '+' and '-'
     1598        while (tmpLinePtr != end && (*tmpLinePtr=='+' || *tmpLinePtr=='-'))
     1599        {
     1600            if (*tmpLinePtr=='-')
     1601                addition = !addition;
     1602            skipCharAndSpacesToEnd(tmpLinePtr, end);
     1603        }
    16081604        uint64_t tmp = 0;
    1609         if (!isDigit(*tmpLinePtr) && *tmpLinePtr!='\'')
     1605        if (tmpLinePtr == end || (!isDigit(*tmpLinePtr) && *tmpLinePtr!='\''))
    16101606            return false;
    16111607        if (!assembler.parseLiteralNoError(tmp, tmpLinePtr))
  • CLRadeonExtender/trunk/tests/amdasm/AsmExprParse.cpp

    r3575 r3576  
    431431    { " 4 - 7 + 11-54", -46ULL, "", true },
    432432    { " -1 +7+8 + 1 + 124 + 7", 146, "", true },
     433    { " 15 + + 12 ", 27, "", true },
     434    { " 15 + - 12 ", 3, "", true },
     435    { " 15 - + 12 ", 3, "", true },
     436    { " 15 - - 12 ", 27, "", true },
    433437    { " 15 + 12;", 27, ";", true },
    434438    { " 15 + 12 ( ", 27, "( ", true },
Note: See TracChangeset for help on using the changeset viewer.