ramseg.c 448 B

123456789101112131415
  1. #include "ramseg.h"
  2. int size_array(int *ram_seg, int nrows, int ncols)
  3. {
  4. int size, segs_in_col;
  5. segs_in_col = ((nrows - 1) >> RAMSEGBITS) + 1;
  6. *ram_seg = ((ncols - 1) >> RAMSEGBITS) + 1;
  7. size = ((((nrows - 1) >> RAMSEGBITS) + 1) << RAMSEGBITS) *
  8. ((((ncols - 1) >> RAMSEGBITS) + 1) << RAMSEGBITS);
  9. size -= ((segs_in_col << RAMSEGBITS) - nrows) << RAMSEGBITS;
  10. size -= (*ram_seg << RAMSEGBITS) - ncols;
  11. return (size);
  12. }