OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_51/] [or1ksim/] [cuc/] [cuc.c] - Diff between revs 1098 and 1244

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 1098 Rev 1244
Line 46... Line 46...
  0, 1, 0, 1, 0, 1, 0, 1,
  0, 1, 0, 1, 0, 1, 0, 1,
  0, 1, 0, 1, 0, 1, 0, 1,
  0, 1, 0, 1, 0, 1, 0, 1,
  1, 1};
  1, 1};
 
 
/* returns log2(x) */
/* returns log2(x) */
int log2 (unsigned long x)
/* Call this log2_int, because there is a library function named log2 */
 
int log2_int (unsigned long x)
{
{
  int c = 0;
  int c = 0;
  assert (x >= 0);
  assert (x >= 0);
  if (!x) return 0; /* not by the book, but practical */
  if (!x) return 0; /* not by the book, but practical */
  while (x != 1) x >>= 1, c++;
  while (x != 1) x >>= 1, c++;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.