diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2018-09-07 22:12:26 +0300 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2018-09-11 17:23:30 +0300 |
commit | 20a7ead8bdf09774c7d58fcbe6a0980d08ed5365 (patch) | |
tree | ef61963222cd03faa20a7a828ea62681caba7bd6 /tests/gem_exec_reuse.c | |
parent | 5f8a33ad1a4ab5ce0d1eb2ba68ccc284d663531c (diff) |
lib: Add roundup_power_of_two()
Add a helper to round a value to the next power of two size.
And since we need fls() to implement that, reuse that elsewhere
as well.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_exec_reuse.c')
-rw-r--r-- | tests/gem_exec_reuse.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/tests/gem_exec_reuse.c b/tests/gem_exec_reuse.c index 8ee38d2b..df220be7 100644 --- a/tests/gem_exec_reuse.c +++ b/tests/gem_exec_reuse.c @@ -56,16 +56,6 @@ static void noop(struct noop *n, gem_execbuf(n->fd, &execbuf); } -static int fls(uint64_t x) -{ - int t; - - for (t = 0; x >> t; t++) - ; - - return t; -} - static bool allow_unlimited_files(void) { struct rlimit rlim; @@ -151,7 +141,7 @@ igt_main if (max < gtt_size) gtt_size = max; - no.nhandles = 1 << (fls(gtt_size) - 1); + no.nhandles = 1 << (igt_fls(gtt_size) - 1); intel_require_memory(no.nhandles, 4096, CHECK_RAM); no.max_age = no.nhandles / 2; |