diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-11-23 01:05:33 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-11-23 01:05:33 +0100 |
commit | 2f9ae0f8ac8610e13ced184847b57b87fe5db580 (patch) | |
tree | f9ad2223d518585a2cfe9ea1c73e1e37d07bf637 /sys/src/cmd/unix/drawterm/libmp/mptobe.c | |
parent | ea5797c0731203c09ec5fb7172e77eab2750f1a9 (diff) |
removing (outdated) drawterm
drawterm is much better maintained by russ cox,
so removing this outdated copy.
for a more recent version, go to:
http://swtch.com/drawterm/
Diffstat (limited to 'sys/src/cmd/unix/drawterm/libmp/mptobe.c')
-rw-r--r-- | sys/src/cmd/unix/drawterm/libmp/mptobe.c | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/sys/src/cmd/unix/drawterm/libmp/mptobe.c b/sys/src/cmd/unix/drawterm/libmp/mptobe.c deleted file mode 100644 index e08ae56be..000000000 --- a/sys/src/cmd/unix/drawterm/libmp/mptobe.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "os.h" -#include <mp.h> -#include "dat.h" - -// convert an mpint into a big endian byte array (most significant byte first) -// return number of bytes converted -// if p == nil, allocate and result array -int -mptobe(mpint *b, uchar *p, uint n, uchar **pp) -{ - int i, j, suppress; - mpdigit x; - uchar *e, *s, c; - - if(p == nil){ - n = (b->top+1)*Dbytes; - p = malloc(n); - } - if(p == nil) - return -1; - if(pp != nil) - *pp = p; - memset(p, 0, n); - - // special case 0 - if(b->top == 0){ - if(n < 1) - return -1; - else - return 1; - } - - s = p; - e = s+n; - suppress = 1; - for(i = b->top-1; i >= 0; i--){ - x = b->p[i]; - for(j = Dbits-8; j >= 0; j -= 8){ - c = x>>j; - if(c == 0 && suppress) - continue; - if(p >= e) - return -1; - *p++ = c; - suppress = 0; - } - } - - // guarantee at least one byte - if(s == p){ - if(p >= e) - return -1; - *p++ = 0; - } - - return p - s; -} |