summaryrefslogtreecommitdiff
path: root/sys/src/cmd/unix/drawterm/libmp/mpleft.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2013-11-23 01:05:33 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2013-11-23 01:05:33 +0100
commit2f9ae0f8ac8610e13ced184847b57b87fe5db580 (patch)
treef9ad2223d518585a2cfe9ea1c73e1e37d07bf637 /sys/src/cmd/unix/drawterm/libmp/mpleft.c
parentea5797c0731203c09ec5fb7172e77eab2750f1a9 (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/mpleft.c')
-rw-r--r--sys/src/cmd/unix/drawterm/libmp/mpleft.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/sys/src/cmd/unix/drawterm/libmp/mpleft.c b/sys/src/cmd/unix/drawterm/libmp/mpleft.c
deleted file mode 100644
index 23ff9daa4..000000000
--- a/sys/src/cmd/unix/drawterm/libmp/mpleft.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "os.h"
-#include <mp.h>
-#include "dat.h"
-
-// res = b << shift
-void
-mpleft(mpint *b, int shift, mpint *res)
-{
- int d, l, r, i, otop;
- mpdigit this, last;
-
- // a negative left shift is a right shift
- if(shift < 0){
- mpright(b, -shift, res);
- return;
- }
-
- // b and res may be the same so remember the old top
- otop = b->top;
-
- // shift
- mpbits(res, otop*Dbits + shift); // overkill
- res->top = DIGITS(otop*Dbits + shift);
- d = shift/Dbits;
- l = shift - d*Dbits;
- r = Dbits - l;
-
- if(l == 0){
- for(i = otop-1; i >= 0; i--)
- res->p[i+d] = b->p[i];
- } else {
- last = 0;
- for(i = otop-1; i >= 0; i--) {
- this = b->p[i];
- res->p[i+d+1] = (last<<l) | (this>>r);
- last = this;
- }
- res->p[d] = last<<l;
- }
- for(i = 0; i < d; i++)
- res->p[i] = 0;
-
- // normalize
- while(res->top > 0 && res->p[res->top-1] == 0)
- res->top--;
-}