From b46981f4cecee3a76723d3e6fe453d918b9fd578 Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 31 Mar 1987 10:58:30 +0000 Subject: [PATCH] converted to 4-4 --- lang/pc/libpc/pac.c | 2 +- lang/pc/libpc/unp.c | 2 +- lang/pc/libpc/wri.c | 34 +++++++++++++++++++++++++++------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/lang/pc/libpc/pac.c b/lang/pc/libpc/pac.c index 8cea845ba..ddab405a2 100644 --- a/lang/pc/libpc/pac.c +++ b/lang/pc/libpc/pac.c @@ -39,7 +39,7 @@ _pac(ad,zd,zp,i,ap) int i; struct descr *ad,*zd; char *zp,*ap; { ap += (i * ad->size); i = (zd->diff + 1) * zd->size; if (zd->size == 1) { - assert(ad->size == 2); + assert(ad->size == EM_WSIZE); while (--i >= 0) *zp++ = *((int *)ap)++; } else { diff --git a/lang/pc/libpc/unp.c b/lang/pc/libpc/unp.c index d66730230..10990c5d6 100644 --- a/lang/pc/libpc/unp.c +++ b/lang/pc/libpc/unp.c @@ -39,7 +39,7 @@ _unp(ad,zd,i,ap,zp) int i; struct descr *ad,*zd; char *ap,*zp; { ap += (i * ad->size); i = (zd->diff + 1) * zd->size; if (zd->size == 1) { - assert(ad->size == 2); + assert(ad->size == EM_WSIZE); while (--i >= 0) *((int *)ap)++ = *zp++; } else { diff --git a/lang/pc/libpc/wri.c b/lang/pc/libpc/wri.c index 37bac5aac..7d3066091 100644 --- a/lang/pc/libpc/wri.c +++ b/lang/pc/libpc/wri.c @@ -20,13 +20,33 @@ extern _wstrin(); -_wsi(w,i,f) int w,i; struct file *f; { - char *p; int j; char buf[6]; +#if EM_WSIZE==4 +#define SZ 11 +#define MININT -2147483648 +#define STRMININT "-2147483648" +#endif +#if EM_WSIZE==2 +#define SZ 6 +#define MININT -32768 +#define STRMININT "-32768" +#endif +#if EM_WSIZE==1 +#define SZ 4 +#define MININT -128 +#define STRMININT "-128" +#endif - p = &buf[6]; +#ifndef STRMININT +Something wrong here! +#endif + +_wsi(w,i,f) int w,i; struct file *f; { + char *p; int j; char buf[SZ]; + + p = &buf[SZ]; if ((j=i) < 0) { - if (i == -32768) { - _wstrin(w,6,"-32768",f); + if (i == MININT) { + _wstrin(w,SZ,STRMININT,f); return; } j = -j; @@ -36,9 +56,9 @@ _wsi(w,i,f) int w,i; struct file *f; { while (j /= 10); if (i<0) *--p = '-'; - _wstrin(w,&buf[6]-p,p,f); + _wstrin(w,&buf[SZ]-p,p,f); } _wri(i,f) int i; struct file *f; { - _wsi(6,i,f); + _wsi(SZ,i,f); }