mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-31 20:11:29 +00:00
Fixing a bug that resulted with broken pitch range on non MSVC systems. (#215)
This commit is contained in:
parent
29cae1a3f8
commit
8d1da90d78
1 changed files with 2 additions and 2 deletions
|
@ -52,7 +52,7 @@ static int bsr(uint16_t v) {
|
||||||
static int bsr(uint16_t v)
|
static int bsr(uint16_t v)
|
||||||
{
|
{
|
||||||
if (v) {
|
if (v) {
|
||||||
return 16 - __builtin_clz(v);
|
return 32 - __builtin_clz(v);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -64,7 +64,7 @@ static int bsr(uint16_t v)
|
||||||
static int bsr(uint16_t v)
|
static int bsr(uint16_t v)
|
||||||
{
|
{
|
||||||
uint16_t mask = 0x8000;
|
uint16_t mask = 0x8000;
|
||||||
for (int i = 31; i >= 0; --i) {
|
for (int i = 15; i >= 0; --i) {
|
||||||
if (v&mask)
|
if (v&mask)
|
||||||
return (int)i;
|
return (int)i;
|
||||||
mask>>=1;
|
mask>>=1;
|
||||||
|
|
Loading…
Reference in a new issue