home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Acorn User 10
/
AU_CD10.iso
/
Archived
/
Updates
/
Flash
/
writeflash
/
!MakeFlash
/
c
/
rectangle
< prev
next >
Wrap
Text File
|
2000-04-05
|
860b
|
38 lines
#include <stdio.h>
//
#include "proto.h"
#include "bitcount.h"
#include "bucket.h"
#include "rectangle.h"
int rect_read(RECT *rect) {
U32 bits;
if (read_ubits(5, &bits)) return 1;
if (read_bits(bits, &rect->minx)) return 1;
if (read_bits(bits, &rect->maxx)) return 1;
if (read_bits(bits, &rect->miny)) return 1;
if (read_bits(bits, &rect->maxy)) return 1;
return 0;
}
int rect_write(RECT *rect) {
int bits;
bits = bitcount_signed(rect->minx, rect->miny, rect->maxx, rect->maxy);
if (bits == 32) return 1;
if (write_ubits(5, bits)) return 1;
if (write_bits(bits, rect->minx)) return 1;
if (write_bits(bits, rect->maxx)) return 1;
if (write_bits(bits, rect->miny)) return 1;
if (write_bits(bits, rect->maxy)) return 1;
return 0;
}