changed word_type to word_t.

Wed, 12 Mar 2003 10:59:09 +0000

author
eric
date
Wed, 12 Mar 2003 10:59:09 +0000
changeset 109
663da96ad2bc
parent 108
9b35b78d4c91
child 110
cb75ec9430b4

changed word_type to word_t.

bitblt.c file | annotate | diff | revisions
bitblt.h file | annotate | diff | revisions
     1.1 diff -r 9b35b78d4c91 -r 663da96ad2bc bitblt.c
     1.2 --- a/bitblt.c	Wed Mar 12 10:58:33 2003 +0000
     1.3 +++ b/bitblt.c	Wed Mar 12 10:59:09 2003 +0000
     1.4 @@ -4,7 +4,7 @@
     1.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     1.6   *
     1.7   * bitblt routines
     1.8 - * $Id: bitblt.c,v 1.14 2003/03/11 22:02:46 eric Exp $
     1.9 + * $Id: bitblt.c,v 1.15 2003/03/12 02:59:09 eric Exp $
    1.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    1.11   *
    1.12   * This program is free software; you can redistribute it and/or modify
    1.13 @@ -49,7 +49,7 @@
    1.14  }
    1.15  
    1.16  
    1.17 -static word_type bit_reverse_word (word_type d)
    1.18 +static word_t bit_reverse_word (word_t d)
    1.19  {
    1.20    return (bit_reverse_byte [d >> 24] |
    1.21  	  (bit_reverse_byte [(d >> 16) & 0xff] << 8) |
    1.22 @@ -58,8 +58,8 @@
    1.23  }
    1.24  
    1.25  
    1.26 -static word_type *temp_buffer;
    1.27 -static word_type temp_buffer_size;
    1.28 +static word_t *temp_buffer;
    1.29 +static word_t temp_buffer_size;
    1.30  
    1.31  static void realloc_temp_buffer (uint32_t size)
    1.32  {
    1.33 @@ -75,10 +75,10 @@
    1.34  }
    1.35  
    1.36  
    1.37 -static inline word_type pixel_mask (int x)
    1.38 +static inline word_t pixel_mask (int x)
    1.39  {
    1.40  #if defined (MIXED_ENDIAN)  /* disgusting hack for mixed-endian */
    1.41 -  word_type m;
    1.42 +  word_t m;
    1.43    m = 0x80 >> (x & 7);
    1.44    m <<= (x & 24);
    1.45    return (m);
    1.46 @@ -91,9 +91,9 @@
    1.47  
    1.48  
    1.49  /* mask for range of bits left..right, inclusive */
    1.50 -static inline word_type pixel_range_mask (int left, int right)
    1.51 +static inline word_t pixel_range_mask (int left, int right)
    1.52  {
    1.53 -  word_type m1, m2, val;
    1.54 +  word_t m1, m2, val;
    1.55  
    1.56    /* $$$ one of these cases is wrong! */
    1.57  #if defined (LSB_RIGHT)
    1.58 @@ -124,7 +124,7 @@
    1.59      return (NULL);
    1.60    bitmap->rect = * rect;
    1.61    bitmap->row_words = DIV_ROUND_UP (width, BITS_PER_WORD);
    1.62 -  bitmap->bits = calloc (1, height * bitmap->row_words * sizeof (word_type));
    1.63 +  bitmap->bits = calloc (1, height * bitmap->row_words * sizeof (word_t));
    1.64    if (! bitmap->bits)
    1.65      {
    1.66        free (bitmap);
    1.67 @@ -141,7 +141,7 @@
    1.68  
    1.69  bool get_pixel (Bitmap *bitmap, Point coord)
    1.70  {
    1.71 -  word_type *p;
    1.72 +  word_t *p;
    1.73    int w,b;
    1.74  
    1.75    if ((coord.x < bitmap->rect.min.x) ||
    1.76 @@ -159,7 +159,7 @@
    1.77  
    1.78  void set_pixel (Bitmap *bitmap, Point coord, bool value)
    1.79  {
    1.80 -  word_type *p;
    1.81 +  word_t *p;
    1.82    int w,b;
    1.83  
    1.84    if ((coord.x < bitmap->rect.min.x) ||
    1.85 @@ -216,10 +216,10 @@
    1.86  			    Rect dest_rect)
    1.87  {
    1.88    uint32_t y;
    1.89 -  word_type *rp;
    1.90 +  word_t *rp;
    1.91    uint32_t left_bit, left_word;
    1.92    uint32_t right_bit, right_word;
    1.93 -  word_type left_mask, right_mask;
    1.94 +  word_t left_mask, right_mask;
    1.95    int32_t word_count;
    1.96  
    1.97    /* This function requires a non-null dest rect */
    1.98 @@ -272,7 +272,7 @@
    1.99  
   1.100    for (y = 0; y < rect_height (& dest_rect); y++)
   1.101      {
   1.102 -      word_type *wp = rp;
   1.103 +      word_t *wp = rp;
   1.104  
   1.105        /* partial word at left, if any */
   1.106        if (left_mask)
   1.107 @@ -316,7 +316,7 @@
   1.108  		 Rect *dest_rect)
   1.109  {
   1.110    int32_t y;
   1.111 -  word_type *rp;
   1.112 +  word_t *rp;
   1.113  
   1.114    /* This function requires a non-null src rect */
   1.115    assert (dest_rect->min.x < dest_rect->max.x);
   1.116 @@ -628,20 +628,20 @@
   1.117  /* in-place transformations */
   1.118  void flip_h (Bitmap *src)
   1.119  {
   1.120 -  word_type *rp;  /* row pointer */
   1.121 -  word_type *p1;  /* work src ptr */
   1.122 -  word_type *p2;  /* work dest ptr */
   1.123 +  word_t *rp;  /* row pointer */
   1.124 +  word_t *p1;  /* work src ptr */
   1.125 +  word_t *p2;  /* work dest ptr */
   1.126    int32_t y;
   1.127    int shift1, shift2;
   1.128  
   1.129 -  realloc_temp_buffer ((src->row_words + 1) * sizeof (word_type));
   1.130 +  realloc_temp_buffer ((src->row_words + 1) * sizeof (word_t));
   1.131  
   1.132    rp = src->bits;
   1.133    if ((rect_width (& src->rect) & 7) == 0)
   1.134      {
   1.135        for (y = src->rect.min.y; y < src->rect.max.y; y++)
   1.136  	{
   1.137 -	  memcpy (temp_buffer, rp, src->row_words * sizeof (word_type));
   1.138 +	  memcpy (temp_buffer, rp, src->row_words * sizeof (word_t));
   1.139  	  p1 = temp_buffer + src->row_words;
   1.140  	  p2 = rp;
   1.141  
   1.142 @@ -659,9 +659,9 @@
   1.143  
   1.144    for (y = src->rect.min.y; y < src->rect.max.y; y++)
   1.145      {
   1.146 -      word_type d1, d2;
   1.147 +      word_t d1, d2;
   1.148  
   1.149 -      memcpy (temp_buffer + 1, rp, src->row_words * sizeof (word_type));
   1.150 +      memcpy (temp_buffer + 1, rp, src->row_words * sizeof (word_t));
   1.151        p1 = temp_buffer + src->row_words;
   1.152        p2 = rp;
   1.153  
   1.154 @@ -680,17 +680,17 @@
   1.155  
   1.156  void flip_v (Bitmap *src)
   1.157  {
   1.158 -  word_type *p1, *p2;
   1.159 +  word_t *p1, *p2;
   1.160  
   1.161 -  realloc_temp_buffer (src->row_words * sizeof (word_type));
   1.162 +  realloc_temp_buffer (src->row_words * sizeof (word_t));
   1.163  
   1.164    p1 = src->bits;
   1.165    p2 = src->bits + src->row_words * (rect_height (& src->rect) - 1);
   1.166    while (p1 < p2)
   1.167      {
   1.168 -      memcpy (temp_buffer, p1, src->row_words * sizeof (word_type));
   1.169 -      memcpy (p1, p2, src->row_words * sizeof (word_type));
   1.170 -      memcpy (p2, temp_buffer, src->row_words * sizeof (word_type));
   1.171 +      memcpy (temp_buffer, p1, src->row_words * sizeof (word_t));
   1.172 +      memcpy (p1, p2, src->row_words * sizeof (word_t));
   1.173 +      memcpy (p2, temp_buffer, src->row_words * sizeof (word_t));
   1.174        p1 += src->row_words;
   1.175        p2 -= src->row_words;
   1.176      }
   1.177 @@ -706,9 +706,9 @@
   1.178  void transpose (Bitmap *src)
   1.179  {
   1.180    uint32_t new_row_words = DIV_ROUND_UP (rect_height (& src->rect), 32);
   1.181 -  word_type *new_bits;
   1.182 +  word_t *new_bits;
   1.183  
   1.184 -  new_bits = calloc (1, new_row_words * rect_width (& src->rect) * sizeof (word_type));
   1.185 +  new_bits = calloc (1, new_row_words * rect_width (& src->rect) * sizeof (word_t));
   1.186  
   1.187    /* $$$ more code needed here */
   1.188  }
     2.1 diff -r 9b35b78d4c91 -r 663da96ad2bc bitblt.h
     2.2 --- a/bitblt.h	Wed Mar 12 10:58:33 2003 +0000
     2.3 +++ b/bitblt.h	Wed Mar 12 10:59:09 2003 +0000
     2.4 @@ -4,7 +4,7 @@
     2.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     2.6   *
     2.7   * bitblt routines
     2.8 - * $Id: bitblt.h,v 1.15 2003/03/11 22:02:46 eric Exp $
     2.9 + * $Id: bitblt.h,v 1.16 2003/03/12 02:59:09 eric Exp $
    2.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    2.11   *
    2.12   * This program is free software; you can redistribute it and/or modify
    2.13 @@ -47,17 +47,17 @@
    2.14  }
    2.15  
    2.16  
    2.17 -/* word_type should be the largest native type that can be handled
    2.18 +/* word_t should be the largest native type that can be handled
    2.19     efficiently, so it shouldn't be a 64-bit type on a processor that
    2.20     doesn't have native 64-bit operations. */
    2.21 -typedef uint32_t word_type;
    2.22 -#define BITS_PER_WORD (8 * sizeof (word_type))
    2.23 +typedef uint32_t word_t;
    2.24 +#define BITS_PER_WORD (8 * sizeof (word_t))
    2.25  #define ALL_ONES (~ 0UL)
    2.26  
    2.27  
    2.28  typedef struct Bitmap
    2.29  {
    2.30 -  word_type *bits;
    2.31 +  word_t *bits;
    2.32    Rect rect;
    2.33    uint32_t row_words;
    2.34  } Bitmap;