It is in lib/util.h:

lib/util.h:#define DIV_ROUND_UP(X, Y) (((X) + ((Y) - 1)) / (Y))
lib/util.h:#define ROUND_UP(X, Y) (DIV_ROUND_UP(X, Y) * (Y))

  Jarno

On Jun 7, 2013, at 17:39 , ext Andy Zhou wrote:

Thanks for the suggestion.

The kernel source I am looking at: 3.9.0-rc8, does not a accessible definition 
of ROUND_UP,  but roundup(x,y) is, and fits the bill.  I am thinking of using 
it instead, unless it breaks on some older kernel version that we care about.

>From kernel.h:

/* 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.rajaha...@nsn.com<mailto:jarno.rajaha...@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.


_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to