- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an array of signed ints, and I would like to divide by 2^n. I currently use this routine to do it: int out = in >= 0 ? int >> n : -((int & 0x7FFFFFFF) >> n);
Is there a better way that does not involve a branch?
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page