Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 20 Nov 2014 04:47:02 -0000
From: weimingz@...eaurora.org
To: "Weiming Zhao" <weimingz@...eaurora.org>
Cc: musl@...ts.openwall.com,
 weimingz@...eaurora.org
Subject: Re: question about malloc's bin_index

I think I need a float-to-int-bits routine. But still I'm not clear why we
need such conversion.

Thanks,
Weiming

> Hi,
>
>
>
> I'm trying to use MUSL on a hardware without floating point unit, however,
> the "union" in the bin_index brings some issues.
>
> I'm using -mgeneral-regs-only and gcc refuses to compile it due to the
> floating point conversion.
>
>
>
> I'm wondering what's the purpose of the union? How should I rewrite it to
> use integer only?
>
>
>
> static int bin_index(size_t x)
>
> {
>
>                 x = x / SIZE_ALIGN - 1;
>
>                 if (x <= 32) return x;
>
>                 if (x > 0x1c00) return 63;
>
>                 return ((union { float v; uint32_t r; }){(int)x}.r>>21) -
> 496;
>
> }
>
>
>
> Thanks a lot,
>
> Weiming
>
>
>
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
>
>
>


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.