Changeset 2fe64d0 in mainline


Ignore:
Timestamp:
2012-08-08T09:38:47Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0da6c04
Parents:
18d4484
Message:

BitHenge/GIF: use operators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/dist/src/bithenge/gif/gif.bh

    r18d4484 r2fe64d0  
    5151};
    5252
    53 transform gif_color_map_from_bits_per_pixel(bits_per_pixel_minus_one) = struct {
     53transform gif_color_map_from_bits_per_pixel(bits_per_pixel) = struct {
    5454        # We need to emulate missing << operator
    55         switch (bits_per_pixel_minus_one) {
    56                 0: { <- gif_color_map(2); };
    57                 1: { <- gif_color_map(4); };
    58                 2: { <- gif_color_map(8); };
    59                 3: { <- gif_color_map(16); };
    60                 4: { <- gif_color_map(32); };
    61                 5: { <- gif_color_map(64); };
    62                 6: { <- gif_color_map(128); };
    63                 7: { <- gif_color_map(256); };
     55        switch (bits_per_pixel) {
     56                1: { <- gif_color_map(2); };
     57                2: { <- gif_color_map(4); };
     58                3: { <- gif_color_map(8); };
     59                4: { <- gif_color_map(16); };
     60                5: { <- gif_color_map(32); };
     61                6: { <- gif_color_map(64); };
     62                7: { <- gif_color_map(128); };
     63                8: { <- gif_color_map(256); };
    6464        }
    6565};
     
    9191                .interlacing <- bit;
    9292                .reserved_bits <- uint_be(3);
    93                 .bits_per_pixel_minus_one <- uint_be(3);
     93                .bits_per_pixel <- (in + 1) <- uint_be(3);
    9494        } <- bits_be <- known_length(1);
    9595       
    9696        if (.use_local_color_map) {
    97                 .local_color_map <- gif_color_map_from_bits_per_pixel(.bits_per_pixel_minus_one);
     97                .local_color_map <- gif_color_map_from_bits_per_pixel(.bits_per_pixel);
    9898        }
    9999       
     
    136136                .color_resolution <- uint_be(3);
    137137                .reserved_bit <- uint_be(1);
    138                 .bits_per_pixel_minus_one <- uint_be(3);
     138                .bits_per_pixel <- (in + 1) <- uint_be(3);
    139139        } <- bits_be <- known_length(1);
    140140        .background_color_index <- uint8;
    141141        .reserved <- uint8;
    142142        if (.global_color_map_exists) {
    143                 .global_color_map <- gif_color_map_from_bits_per_pixel(.bits_per_pixel_minus_one);
     143                .global_color_map <- gif_color_map_from_bits_per_pixel(.bits_per_pixel);
    144144        }
    145145        .blocks <- repeat {
Note: See TracChangeset for help on using the changeset viewer.