Subj : Re: right shifting to divide To : comp.programming From : Rob Somers Date : Sun Jul 31 2005 01:01 pm > It returns n/128, rounded up. That's what is says. doh! It was right under my nose - I am not sure why I was thinking 'divided by two' but it was certainly clouding my judgement.. > Because that would divide by two. > > return (n+1) >>1; /* n/2, rounded up */ > > Note: unwanted results may occur, when n is negative. > HTH, > AvK Thanks .