![]() | |||||||||||
Messages in this thread |
Roland Dreier wrote: > Julien> Not very important but ((get_random_int() % 4096) << 4) > Julien> could be optimized into get_random_int() & 0xFFF0. > > HPA> .. and gcc knows that. > > HPA> 8: 25 ff 0f 00 00 and $0xfff,%eax > HPA> d: 83 c4 0c add $0xc,%esp > HPA> 10: c1 e0 04 shl $0x4,%eax > > Actually gcc isn't quite that smart (since it obviously can't > understand the semantics of get_random int()). The original point was > that the "shl $0x4" can be avoided by directly &'ing with 0xfff0, not > that "% 4096" can be strength reduced to "& 0xfff". > Oh, right. D'oh! :) -hpa - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ | ||||||||||
| Last update: 2005-03-22 14:09 [from the cache] ©2003-2008 | |||||||||||