mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-30 20:10:24 +01:00
Nouveau: move the definition of log2i() to header
Also make the type unsigned instead of signed, since negative values do not make sense. Signed-off-by: Pekka Paalanen <pq@iki.fi>
This commit is contained in:
parent
079116e6a4
commit
f72848a09a
7 changed files with 33 additions and 156 deletions
|
|
@ -61,4 +61,31 @@ nouveau_vbuf_split(unsigned remaining, unsigned overhead, unsigned vpp,
|
|||
return max;
|
||||
}
|
||||
|
||||
/* Integer base-2 logarithm, rounded towards zero. */
|
||||
static INLINE unsigned log2i(unsigned i)
|
||||
{
|
||||
unsigned r = 0;
|
||||
|
||||
if (i & 0xffff0000) {
|
||||
i >>= 16;
|
||||
r += 16;
|
||||
}
|
||||
if (i & 0x0000ff00) {
|
||||
i >>= 8;
|
||||
r += 8;
|
||||
}
|
||||
if (i & 0x000000f0) {
|
||||
i >>= 4;
|
||||
r += 4;
|
||||
}
|
||||
if (i & 0x0000000c) {
|
||||
i >>= 2;
|
||||
r += 2;
|
||||
}
|
||||
if (i & 0x00000002) {
|
||||
r += 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,30 +1,5 @@
|
|||
#include "nv04_context.h"
|
||||
|
||||
static INLINE int log2i(int i)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
if (i & 0xffff0000) {
|
||||
i >>= 16;
|
||||
r += 16;
|
||||
}
|
||||
if (i & 0x0000ff00) {
|
||||
i >>= 8;
|
||||
r += 8;
|
||||
}
|
||||
if (i & 0x000000f0) {
|
||||
i >>= 4;
|
||||
r += 4;
|
||||
}
|
||||
if (i & 0x0000000c) {
|
||||
i >>= 2;
|
||||
r += 2;
|
||||
}
|
||||
if (i & 0x00000002) {
|
||||
r += 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#include "nouveau/nouveau_util.h"
|
||||
|
||||
#define _(m,tf) \
|
||||
{ \
|
||||
|
|
|
|||
|
|
@ -1,30 +1,5 @@
|
|||
#include "nv10_context.h"
|
||||
|
||||
static INLINE int log2i(int i)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
if (i & 0xffff0000) {
|
||||
i >>= 16;
|
||||
r += 16;
|
||||
}
|
||||
if (i & 0x0000ff00) {
|
||||
i >>= 8;
|
||||
r += 8;
|
||||
}
|
||||
if (i & 0x000000f0) {
|
||||
i >>= 4;
|
||||
r += 4;
|
||||
}
|
||||
if (i & 0x0000000c) {
|
||||
i >>= 2;
|
||||
r += 2;
|
||||
}
|
||||
if (i & 0x00000002) {
|
||||
r += 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#include "nouveau/nouveau_util.h"
|
||||
|
||||
#define _(m,tf) \
|
||||
{ \
|
||||
|
|
|
|||
|
|
@ -1,30 +1,5 @@
|
|||
#include "nv20_context.h"
|
||||
|
||||
static INLINE int log2i(int i)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
if (i & 0xffff0000) {
|
||||
i >>= 16;
|
||||
r += 16;
|
||||
}
|
||||
if (i & 0x0000ff00) {
|
||||
i >>= 8;
|
||||
r += 8;
|
||||
}
|
||||
if (i & 0x000000f0) {
|
||||
i >>= 4;
|
||||
r += 4;
|
||||
}
|
||||
if (i & 0x0000000c) {
|
||||
i >>= 2;
|
||||
r += 2;
|
||||
}
|
||||
if (i & 0x00000002) {
|
||||
r += 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#include "nouveau/nouveau_util.h"
|
||||
|
||||
#define _(m,tf) \
|
||||
{ \
|
||||
|
|
|
|||
|
|
@ -1,30 +1,5 @@
|
|||
#include "nv30_context.h"
|
||||
|
||||
static INLINE int log2i(int i)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
if (i & 0xffff0000) {
|
||||
i >>= 16;
|
||||
r += 16;
|
||||
}
|
||||
if (i & 0x0000ff00) {
|
||||
i >>= 8;
|
||||
r += 8;
|
||||
}
|
||||
if (i & 0x000000f0) {
|
||||
i >>= 4;
|
||||
r += 4;
|
||||
}
|
||||
if (i & 0x0000000c) {
|
||||
i >>= 2;
|
||||
r += 2;
|
||||
}
|
||||
if (i & 0x00000002) {
|
||||
r += 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#include "nouveau/nouveau_util.h"
|
||||
|
||||
#define _(m,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w) \
|
||||
{ \
|
||||
|
|
|
|||
|
|
@ -1,30 +1,5 @@
|
|||
#include "nv30_context.h"
|
||||
|
||||
static INLINE int log2i(int i)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
if (i & 0xffff0000) {
|
||||
i >>= 16;
|
||||
r += 16;
|
||||
}
|
||||
if (i & 0x0000ff00) {
|
||||
i >>= 8;
|
||||
r += 8;
|
||||
}
|
||||
if (i & 0x000000f0) {
|
||||
i >>= 4;
|
||||
r += 4;
|
||||
}
|
||||
if (i & 0x0000000c) {
|
||||
i >>= 2;
|
||||
r += 2;
|
||||
}
|
||||
if (i & 0x00000002) {
|
||||
r += 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#include "nouveau/nouveau_util.h"
|
||||
|
||||
static boolean
|
||||
nv30_state_framebuffer_validate(struct nv30_context *nv30)
|
||||
|
|
|
|||
|
|
@ -1,30 +1,5 @@
|
|||
#include "nv40_context.h"
|
||||
|
||||
static INLINE int log2i(int i)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
if (i & 0xffff0000) {
|
||||
i >>= 16;
|
||||
r += 16;
|
||||
}
|
||||
if (i & 0x0000ff00) {
|
||||
i >>= 8;
|
||||
r += 8;
|
||||
}
|
||||
if (i & 0x000000f0) {
|
||||
i >>= 4;
|
||||
r += 4;
|
||||
}
|
||||
if (i & 0x0000000c) {
|
||||
i >>= 2;
|
||||
r += 2;
|
||||
}
|
||||
if (i & 0x00000002) {
|
||||
r += 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#include "nouveau/nouveau_util.h"
|
||||
|
||||
static boolean
|
||||
nv40_state_framebuffer_validate(struct nv40_context *nv40)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue