Drop 10 MSB bit and 10 left shift operation without multiply operation.
Change-Id: I9cc0d5a3f131686c49757edfc2565f25e6a1ecef
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
#ifndef BIT32
#define BIT32(x) (1UL << x)
#endif
+#ifndef GENMASK64
+#define GENMASK64(h, l) (((~0ULL) << (l)) & (~0ULL >> (64 - 1 - (h))))
+#endif
#ifndef container_of
#define container_of(ptr, type, member) ({ \
while (fgets(buf, BUFF_MAX, fp)) {
if (!strncmp(buf, key, strlen(key))) {
sscanf(buf, "%*s %"PRIu64, val);
- if (strstr(buf, "kB"))
- *val *= 1024;
+ if (strstr(buf, "kB")) {
+ *val &= GENMASK64(53, 0);
+ *val <<= 10;
+ }
break;
}
}