No subject


Fri Jun 29 21:31:54 UTC 2012


/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
#define roundup(x, y) (                 \
{                           \
    const typeof(y) __y = y;            \
    (((x) + (__y - 1)) / __y) * __y;        \
}


On Fri, Jun 7, 2013 at 7:19 AM, Rajahalme, Jarno (NSN - FI/Espoo) <
jarno.rajahalme at nsn.com> wrote:

>
>  On Jun 7, 2013, at 13:35 , ext Andy Zhou wrote:
>
>  Is this the same as DIV_ROUND_UP?
>>
> I did not use it because DIV_ROUND_UP gives the roundup of u32, I needed
> the roundup in bytes.  However, I could rewrite this function using
> DIV_ROUND_UP.
>
>
> There is ROUND_UP doing that already.
>

--001a11c2e2384dd32c04de916645
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thanks for the suggestion. <br><br>The kernel source I am =
looking at: 3.9.0-rc8, does not a accessible definition of ROUND_UP,=A0 but=
 roundup(x,y) is, and fits the bill.=A0 I am thinking of using it instead, =
unless it breaks on some older kernel version that we care about. <br>
<br>From kernel.h: <br><br>/* The `const&#39; in roundup() prevents gcc-3.3=
 from calling __divdi3 */<br>#define roundup(x, y) (=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0 \<br>{=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 \<br>=A0=A0=A0 const typeof(y) __y =
=3D y;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 \<br>
=A0=A0=A0 (((x) + (__y - 1)) / __y) * __y;=A0=A0=A0=A0=A0=A0=A0 \<br>}=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br></di=
v><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Fri, Jun=
 7, 2013 at 7:19 AM, Rajahalme, Jarno (NSN - FI/Espoo) <span dir=3D"ltr">&l=
t;<a href=3D"mailto:jarno.rajahalme at nsn.com" target=3D"_blank">jarno.rajaha=
lme at nsn.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">



<div style=3D"word-wrap:break-word"><div class=3D"im">
<br>
<div>
<div>On Jun 7, 2013, at 13:35 , ext Andy Zhou wrote:</div>
<br>
<blockquote type=3D"cite"><span style=3D"border-collapse:separate;font-fami=
ly:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;lette=
r-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px=
;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">
<blockquote class=3D"gmail_quote" style=3D"margin-top:0px;margin-right:0px;=
margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color=
:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Is this the same as DIV_ROUND_UP?<br>
</blockquote>
<div>I did not use it because DIV_ROUND_UP gives the roundup of u32, I need=
ed the roundup in bytes.=A0 However, I could rewrite this function using DI=
V_ROUND_UP.<span>=A0</span></div>
</span></blockquote>
</div>
<br>
</div><div>There is ROUND_UP doing that already.</div>
</div>

</blockquote></div><br></div>

--001a11c2e2384dd32c04de916645--


More information about the dev mailing list