]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - lib/strto.c
ARC: dwmmc: Adding DesignWare MMC driver support for ARC devboards
[thirdparty/u-boot.git] / lib / strto.c
index b7fc31d6e5dffab4d99054efa03d4a6c2aa9cb93..55ff9f7437d515d3a78aea4d8e23b01f2957322c 100644 (file)
@@ -94,12 +94,11 @@ unsigned long ustrtoul(const char *cp, char **endp, unsigned int base)
                /* fall through */
        case 'k':
                result *= 1024;
-               if ((*endp)[1] == 'i') {
-                       if ((*endp)[2] == 'B')
-                               (*endp) += 3;
-                       else
-                               (*endp) += 2;
-               }
+               (*endp)++;
+               if (**endp == 'i')
+                       (*endp)++;
+               if (**endp == 'B')
+                       (*endp)++;
        }
        return result;
 }
@@ -116,12 +115,11 @@ unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base)
                /* fall through */
        case 'k':
                result *= 1024;
-               if ((*endp)[1] == 'i') {
-                       if ((*endp)[2] == 'B')
-                               (*endp) += 3;
-                       else
-                               (*endp) += 2;
-               }
+               (*endp)++;
+               if (**endp == 'i')
+                       (*endp)++;
+               if (**endp == 'B')
+                       (*endp)++;
        }
        return result;
 }