mirror of
https://gitee.com/bianbu-linux/opensbi
synced 2025-04-24 14:57:07 -04:00
23 lines
397 B
C
23 lines
397 B
C
/*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
|
|
*
|
|
* Common helper functions used across OpenSBI project.
|
|
*
|
|
* Authors:
|
|
* Atish Patra <atish.patra@wdc.com>
|
|
*/
|
|
|
|
unsigned long log2roundup(unsigned long x)
|
|
{
|
|
unsigned long ret = 0;
|
|
|
|
while (ret < __riscv_xlen) {
|
|
if (x <= (1UL << ret))
|
|
break;
|
|
ret++;
|
|
}
|
|
|
|
return ret;
|
|
}
|