t64-bit fixes from plan 9 - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit cbf43783043acd39ede85a4e82566b914078b4cb
 (DIR) parent dbbfb316fbf21fbc09635283bfc526da0f387df3
 (HTM) Author: rsc <devnull@localhost>
       Date:   Thu, 20 Apr 2006 20:35:35 +0000
       
       64-bit fixes from plan 9
       
       Diffstat:
         M src/cmd/samterm/mesg.c              |      36 ++++++++++++++++----------------
         M src/cmd/samterm/plan9.c             |       4 ++--
         M src/cmd/samterm/samterm.h           |       6 +++---
       
       3 files changed, 23 insertions(+), 23 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/samterm/mesg.c b/src/cmd/samterm/mesg.c
       t@@ -22,7 +22,7 @@ int        exiting;
        void        inmesg(Hmesg, int);
        int        inshort(int);
        long        inlong(int);
       -long        invlong(int);
       +vlong        invlong(int);
        void        hsetdot(int, long, long);
        void        hmoveto(int, long);
        void        hsetsnarf(int);
       t@@ -331,7 +331,7 @@ clrlock(void)
        void
        startfile(Text *t)
        {
       -        outTsv(Tstartfile, t->tag, t);                /* for 64-bit pointers */
       +        outTsv(Tstartfile, t->tag, (vlong)t);                /* for 64-bit pointers */
                setlock();
        }
        
       t@@ -339,7 +339,7 @@ void
        startnewfile(int type, Text *t)
        {
                t->tag = Untagged;
       -        outTv(type, t);                                /* for 64-bit pointers */
       +        outTv(type, (vlong)t);                                /* for 64-bit pointers */
        }
        
        int
       t@@ -355,15 +355,15 @@ inlong(int n)
                        ((long)indata[n+2]<<16)|((long)indata[n+3]<<24);
        }
        
       -long
       +vlong
        invlong(int n)
        {
       -        long l;
       +        vlong v;
        
       -        l = (indata[n+7]<<24) | (indata[n+6]<<16) | (indata[n+5]<<8) | indata[n+4];
       -        l = (l<<16) | (indata[n+3]<<8) | indata[n+2];
       -        l = (l<<16) | (indata[n+1]<<8) | indata[n];
       -        return l;
       +        v = (indata[n+7]<<24) | (indata[n+6]<<16) | (indata[n+5]<<8) | indata[n+4];
       +        v = (v<<16) | (indata[n+3]<<8) | indata[n+2];
       +        v = (v<<16) | (indata[n+1]<<8) | indata[n];
       +        return v;
        }
        
        void
       t@@ -418,19 +418,19 @@ outTsl(Tmesg type, int s1, long l1)
        }
        
        void
       -outTsv(Tmesg type, int s1, void *l1)
       +outTsv(Tmesg type, int s1, vlong v1)
        {
                outstart(type);
                outshort(s1);
       -        outvlong(l1);
       +        outvlong(v1);
                outsend();
        }
        
        void
       -outTv(Tmesg type, void *l1)
       +outTv(Tmesg type, vlong v1)
        {
                outstart(type);
       -        outvlong(l1);
       +        outvlong(v1);
                outsend();
        }
        
       t@@ -498,15 +498,15 @@ outlong(long l)
        }
        
        void
       -outvlong(void *v)
       +outvlong(vlong v)
        {
                int i;
       -        ulong l;
                uchar buf[8];
        
       -        l = (ulong) v;
       -        for(i = 0; i < sizeof(buf); i++, l >>= 8)
       -                buf[i] = l;
       +        for(i = 0; i < sizeof(buf); i++){
       +                buf[i] = v;
       +                v >>= 8;
       +        }
        
                outcopy(8, buf);
        }
 (DIR) diff --git a/src/cmd/samterm/plan9.c b/src/cmd/samterm/plan9.c
       t@@ -121,7 +121,7 @@ extproc(void *argv)
        
                arg = argv;
                c = arg[0];
       -        fd = (int)arg[1];
       +        fd = (int)(uintptr)arg[1];
        
                i = 0;
                for(;;){
       t@@ -190,7 +190,7 @@ extstart(void)
                plumbc = chancreate(sizeof(int), 0);
                chansetname(plumbc, "plumbc");
                arg[0] = plumbc;
       -        arg[1] = (void*)fd;
       +        arg[1] = (void*)(uintptr)fd;
                proccreate(extproc, arg, STACK);
                atexit(removeextern);
        }
 (DIR) diff --git a/src/cmd/samterm/samterm.h b/src/cmd/samterm/samterm.h
       t@@ -173,12 +173,12 @@ void        outTl(Tmesg, long);
        void        outTslS(Tmesg, int, long, Rune*);
        void        outTsll(Tmesg, int, long, long);
        void        outTsl(Tmesg, int, long);
       -void        outTsv(Tmesg, int, void*);
       -void        outTv(Tmesg, void*);
       +void        outTsv(Tmesg, int, vlong);
       +void        outTv(Tmesg, vlong);
        void        outstart(Tmesg);
        void        outcopy(int, uchar*);
        void        outshort(int);
        void        outlong(long);
       -void        outvlong(void*);
       +void        outvlong(vlong);
        void        outsend(void);