64-bit fixes from lucho
This commit is contained in:
parent
93aa30a8df
commit
2634795b5f
4 changed files with 13 additions and 11 deletions
|
|
@ -24,7 +24,7 @@ unitsperline(Rectangle r, int d, int bitsperunit)
|
||||||
int
|
int
|
||||||
wordsperline(Rectangle r, int d)
|
wordsperline(Rectangle r, int d)
|
||||||
{
|
{
|
||||||
return unitsperline(r, d, 8*sizeof(ulong));
|
return unitsperline(r, d, 8*sizeof(u32int));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ memimagemove(void *from, void *to)
|
||||||
md->base = to;
|
md->base = to;
|
||||||
|
|
||||||
/* if allocmemimage changes this must change too */
|
/* if allocmemimage changes this must change too */
|
||||||
md->bdata = (uchar*)&md->base[2];
|
md->bdata = (uchar*)((ulong*)md->base+2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Memimage*
|
Memimage*
|
||||||
|
|
@ -71,6 +71,7 @@ _allocmemimage(Rectangle r, u32int chan)
|
||||||
{
|
{
|
||||||
int d;
|
int d;
|
||||||
u32int l, nw;
|
u32int l, nw;
|
||||||
|
ulong *ul;
|
||||||
Memdata *md;
|
Memdata *md;
|
||||||
Memimage *i;
|
Memimage *i;
|
||||||
|
|
||||||
|
|
@ -87,22 +88,23 @@ _allocmemimage(Rectangle r, u32int chan)
|
||||||
|
|
||||||
md->ref = 1;
|
md->ref = 1;
|
||||||
/*
|
/*
|
||||||
* The first two words are the md and the callerpc.
|
* The first two ulongs are the md and the callerpc.
|
||||||
* Then nw words of data.
|
* Then nw words of data.
|
||||||
* The final word lets the drawing routines be a little
|
* The final word lets the drawing routines be a little
|
||||||
* sloppy about reading past the end of the block.
|
* sloppy about reading past the end of the block.
|
||||||
*/
|
*/
|
||||||
md->base = poolalloc(imagmem, (2+nw+1)*sizeof(u32int));
|
md->base = poolalloc(imagmem, 2*sizeof(ulong)+(nw+1)*sizeof(u32int));
|
||||||
if(md->base == nil){
|
if(md->base == nil){
|
||||||
free(md);
|
free(md);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
md->base[0] = (u32int)md;
|
ul = (ulong*)md->base;
|
||||||
md->base[1] = getcallerpc(&r);
|
ul[0] = (ulong)md;
|
||||||
|
ul[1] = getcallerpc(&r);
|
||||||
|
|
||||||
/* if this changes, memimagemove must change too */
|
/* if this changes, memimagemove must change too */
|
||||||
md->bdata = (uchar*)&md->base[2];
|
md->bdata = (uchar*)(ul+2);
|
||||||
|
|
||||||
md->allocd = 1;
|
md->allocd = 1;
|
||||||
|
|
||||||
|
|
@ -135,7 +137,7 @@ _freememimage(Memimage *i)
|
||||||
u32int*
|
u32int*
|
||||||
wordaddr(Memimage *i, Point p)
|
wordaddr(Memimage *i, Point p)
|
||||||
{
|
{
|
||||||
return (u32int*) ((u32int)byteaddr(i, p) & ~(sizeof(u32int)-1));
|
return (u32int*) ((ulong)byteaddr(i, p) & ~(sizeof(u32int)-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
uchar*
|
uchar*
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ getmemdefont(void)
|
||||||
* declared as char*, not u32int*.
|
* declared as char*, not u32int*.
|
||||||
*/
|
*/
|
||||||
p = (char*)defontdata;
|
p = (char*)defontdata;
|
||||||
n = (u32int)p & 3;
|
n = (ulong)p & 3;
|
||||||
if(n != 0){
|
if(n != 0){
|
||||||
memmove(p+(4-n), p, sizeofdefont-n);
|
memmove(p+(4-n), p, sizeofdefont-n);
|
||||||
p += 4-n;
|
p += 4-n;
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ mod(long x, long y)
|
||||||
long z;
|
long z;
|
||||||
|
|
||||||
z = x%y;
|
z = x%y;
|
||||||
if((long)(((u32int)z)^((u32int)y)) > 0 || z == 0)
|
if((long)(((ulong)z)^((ulong)y)) > 0 || z == 0)
|
||||||
return z;
|
return z;
|
||||||
return z + y;
|
return z + y;
|
||||||
}
|
}
|
||||||
|
|
@ -134,7 +134,7 @@ mod(long x, long y)
|
||||||
static long
|
static long
|
||||||
sdiv(long x, long y)
|
sdiv(long x, long y)
|
||||||
{
|
{
|
||||||
if((long)(((u32int)x)^((u32int)y)) >= 0 || x == 0)
|
if((long)(((ulong)x)^((ulong)y)) >= 0 || x == 0)
|
||||||
return x/y;
|
return x/y;
|
||||||
|
|
||||||
return (x+((y>>30)|1))/y-1;
|
return (x+((y>>30)|1))/y-1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue