diff options
author | Orit Wasserman <owasserm@redhat.com> | 2012-08-06 21:42:50 +0300 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2012-08-08 13:51:12 +0200 |
commit | 9fb26641ab497eda9138f9af75cbeb02ed59b5ae (patch) | |
tree | ad4374600d582b27542fc8677048aa3f17f156ed /cutils.c | |
parent | 34c26412b76840e0cab9808047e29aebd429c139 (diff) |
Add cache handling functions
Add MRU page cache mechanism.
The page are accessed by their address.
Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com>
Signed-off-by: Petter Svard <petters@cs.umu.se>
Signed-off-by: Aidan Shribman <aidan.shribman@sap.com>
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'cutils.c')
-rw-r--r-- | cutils.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -382,3 +382,12 @@ int qemu_parse_fd(const char *param) } return fd; } + +/* round down to the nearest power of 2*/ +int64_t pow2floor(int64_t value) +{ + if (!is_power_of_2(value)) { + value = 0x8000000000000000ULL >> clz64(value); + } + return value; +} |