Discussion:
[Proj4] Math Library
(too old to reply)
[Instr] Albert Chae
2008-08-09 02:39:54 UTC
Permalink
Raw Message
You are allowed to use the math library.

Albert
We're trying to figure out a good way to get the number of bits for the index
and offset from the physical address, and it seems like the best way to do it
would be by using the log of certain numbers to figure out how many bits we
need to represent offset and index. Is it alright to compile with the math
library to do this?
Stephen Tu
2008-08-09 03:12:39 UTC
Permalink
Raw Message
We're trying to figure out a good way to get the number of bits for the index
and offset from the physical address, and it seems like the best way to do it
would be by using the log of certain numbers to figure out how many bits we
need to represent offset and index. Is it alright to compile with the math
library to do this?
am i missing something, or does the following function provided in
util.c do just that?

/* finds the highest 1 bit, and returns its position, else 0 */
unsigned int uint_log2(unsigned int w)
[Instr] Albert Chae
2008-08-09 03:30:11 UTC
Permalink
Raw Message
Beat me to it.
We're trying to figure out a good way to get the number of bits for the index
and offset from the physical address, and it seems like the best way to do it
would be by using the log of certain numbers to figure out how many bits we
need to represent offset and index. Is it alright to compile with the math
library to do this?
am i missing something, or does the following function provided in util.c do
just that?
/* finds the highest 1 bit, and returns its position, else 0 */
unsigned int uint_log2(unsigned int w)
[Instr] Albert Chae
2008-08-09 03:13:18 UTC
Permalink
Raw Message
Actually, you don't have to because util.c contains the log you probably
want, and combining that with what you can do with shifting should be
enough.

Albert
Post by [Instr] Albert Chae
You are allowed to use the math library.
Albert
We're trying to figure out a good way to get the number of bits for the index
and offset from the physical address, and it seems like the best way to do it
would be by using the log of certain numbers to figure out how many bits we
need to represent offset and index. Is it alright to compile with the math
library to do this?
Loading...