Changeset da88a079 in mainline


Ignore:
Timestamp:
2010-11-09T21:14:00Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e9e5b9ab
Parents:
a13c6bc
Message:

Fix cstyle.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/adt/bitmap.c

    ra13c6bc rda88a079  
    3232/**
    3333 * @file
    34  * @brief       Implementation of bitmap ADT.
     34 * @brief Implementation of bitmap ADT.
    3535 *
    3636 * This file implements bitmap ADT and provides functions for
     
    5151 * No portion of the bitmap is set or cleared by this function.
    5252 *
    53  * @param bitmap Bitmap structure.
    54  * @param map Address of the memory used to hold the map.
    55  * @param bits Number of bits stored in bitmap.
     53 * @param bitmap        Bitmap structure.
     54 * @param map           Address of the memory used to hold the map.
     55 * @param bits          Number of bits stored in bitmap.
    5656 */
    5757void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, size_t bits)
     
    6363/** Set range of bits.
    6464 *
    65  * @param bitmap Bitmap structure.
    66  * @param start Starting bit.
    67  * @param bits Number of bits to set.
     65 * @param bitmap        Bitmap structure.
     66 * @param start         Starting bit.
     67 * @param bits          Number of bits to set.
    6868 */
    6969void bitmap_set_range(bitmap_t *bitmap, size_t start, size_t bits)
     
    7171        size_t i = 0;
    7272        size_t aligned_start;
    73         size_t lub;             /* leading unaligned bits */
    74         size_t amb;             /* aligned middle bits */
    75         size_t tab;             /* trailing aligned bits */
     73        size_t lub;     /* leading unaligned bits */
     74        size_t amb;     /* aligned middle bits */
     75        size_t tab;     /* trailing aligned bits */
    7676       
    7777        ASSERT(start + bits <= bitmap->bits);
     
    8282        tab = amb % 8;
    8383       
    84         if ( start + bits < aligned_start ) {
    85             /*
    86             * Set bits in the middle of byte
    87             */
    88             bitmap->map[start / 8] |= ((1 << lub)-1) << (start&7);
    89             return;
     84        if (start + bits < aligned_start) {
     85                /* Set bits in the middle of byte. */
     86                bitmap->map[start / 8] |= ((1 << lub) - 1) << (start & 7);
     87                return;
    9088        }
    9189       
    9290        if (lub) {
    93                 /*
    94                  * Make sure to set any leading unaligned bits.
    95                  */
     91                /* Make sure to set any leading unaligned bits. */
    9692                bitmap->map[start / 8] |= ~((1 << (8 - lub)) - 1);
    9793        }
    9894        for (i = 0; i < amb / 8; i++) {
    99                 /*
    100                  * The middle bits can be set byte by byte.
    101                  */
     95                /* The middle bits can be set byte by byte. */
    10296                bitmap->map[aligned_start / 8 + i] = ALL_ONES;
    10397        }
    10498        if (tab) {
    105                 /*
    106                  * Make sure to set any trailing aligned bits.
    107                  */
     99                /* Make sure to set any trailing aligned bits. */
    108100                bitmap->map[aligned_start / 8 + i] |= (1 << tab) - 1;
    109101        }
     
    113105/** Clear range of bits.
    114106 *
    115  * @param bitmap Bitmap structure.
    116  * @param start Starting bit.
    117  * @param bits Number of bits to clear.
     107 * @param bitmap        Bitmap structure.
     108 * @param start         Starting bit.
     109 * @param bits          Number of bits to clear.
    118110 */
    119111void bitmap_clear_range(bitmap_t *bitmap, size_t start, size_t bits)
     
    121113        size_t i = 0;
    122114        size_t aligned_start;
    123         size_t lub;             /* leading unaligned bits */
    124         size_t amb;             /* aligned middle bits */
    125         size_t tab;             /* trailing aligned bits */
     115        size_t lub;     /* leading unaligned bits */
     116        size_t amb;     /* aligned middle bits */
     117        size_t tab;     /* trailing aligned bits */
    126118       
    127119        ASSERT(start + bits <= bitmap->bits);
     
    132124        tab = amb % 8;
    133125
    134         if ( start + bits < aligned_start )
    135         {
    136             /*
    137             * Set bits in the middle of byte
    138             */
    139             bitmap->map[start / 8] &= ~(((1 << lub)-1) << (start&7));
    140             return;
     126        if (start + bits < aligned_start) {
     127                /* Set bits in the middle of byte */
     128                bitmap->map[start / 8] &= ~(((1 << lub) - 1) << (start & 7));
     129                return;
    141130        }
    142131
    143 
    144132        if (lub) {
    145                 /*
    146                  * Make sure to clear any leading unaligned bits.
    147                  */
     133                /* Make sure to clear any leading unaligned bits. */
    148134                bitmap->map[start / 8] &= (1 << (8 - lub)) - 1;
    149135        }
    150136        for (i = 0; i < amb / 8; i++) {
    151                 /*
    152                  * The middle bits can be cleared byte by byte.
    153                  */
     137                /* The middle bits can be cleared byte by byte. */
    154138                bitmap->map[aligned_start / 8 + i] = ALL_ZEROES;
    155139        }
    156140        if (tab) {
    157                 /*
    158                  * Make sure to clear any trailing aligned bits.
    159                  */
     141                /* Make sure to clear any trailing aligned bits. */
    160142                bitmap->map[aligned_start / 8 + i] &= ~((1 << tab) - 1);
    161143        }
     
    165147/** Copy portion of one bitmap into another bitmap.
    166148 *
    167  * @param dst Destination bitmap.
    168  * @param src Source bitmap.
    169  * @param bits Number of bits to copy.
     149 * @param dst           Destination bitmap.
     150 * @param src           Source bitmap.
     151 * @param bits          Number of bits to copy.
    170152 */
    171153void bitmap_copy(bitmap_t *dst, bitmap_t *src, size_t bits)
Note: See TracChangeset for help on using the changeset viewer.