Deleted Added
sdiff udiff text old ( 6216:2f4020838149 ) new ( 7584:28ddf6d9e982 )
full compact
1/*
2 * Copyright (c) 2001, 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 19 unchanged lines hidden (view full) ---

28 * Authors: Nathan Binkert
29 */
30
31#ifndef __BASE_INTMATH_HH__
32#define __BASE_INTMATH_HH__
33
34#include <cassert>
35
36#include "base/types.hh"
37
38// Returns the prime number one less than n.
39int prevPrime(int n);
40
41// Determine if a number is prime
42template <class T>
43inline bool

--- 25 unchanged lines hidden (view full) ---

69
70template <class T>
71inline bool
72isPowerOf2(T n)
73{
74 return n != 0 && leastSigBit(n) == n;
75}
76
77inline int
78floorLog2(unsigned x)
79{
80 assert(x > 0);
81
82 int y = 0;
83
84 if (x & 0xffff0000) { y += 16; x >>= 16; }

--- 148 unchanged lines hidden ---