lkml.org 
[lkml]   [2008]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [lm-sensors] [PATCH 1/2] Create a DIV_ROUND_CLOSEST macro to do division with rounding
Hi,

2008/11/11 Andrew Morton <akpm@linux-foundation.org>:
> yup. I wonder why the compiler doesn't do that for itself - is there a
> case where it will generate a different result?

The test program

#include <stdio.h>
int
main()
{
signed int x = -1;
printf("%d %d\n", x/2, x>>1);
return 0;
}

says

0 -1

so it seems to make a difference.

All the best,
Jochen
--
http://seehuhn.de/


\
 
 \ /
  Last update: 2008-11-12 01:01    [W:0.287 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site