Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 745

Show
Ignore:
Timestamp:
08/15/06 01:34:29 (2 years ago)
Author:
sean
Message:

Added docs for core.Intrinsic, and reformatted/fixed docs for other modules.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/std/intrinsic.di

    r454 r745  
    2222 *  The return value is undefined if v is zero. 
    2323 */ 
    24 int bsf(uint v); 
     24int bsf( uint v ); 
    2525 
    2626 
     
    5353 *  bsr(x21) = 5 
    5454 */ 
    55 int bsr(uint v); 
     55int bsr( uint v ); 
    5656 
    5757 
     
    5959 * Tests the bit. 
    6060 */ 
    61 int bt(uint* p, uint bitnum); 
     61int bt( uint* p, uint bitnum ); 
    6262 
    6363 
     
    6565 * Tests and complements the bit. 
    6666 */ 
    67 int btc(uint* p, uint bitnum); 
     67int btc( uint* p, uint bitnum ); 
    6868 
    6969 
     
    7171 * Tests and resets (sets to 0) the bit. 
    7272 */ 
    73 int btr(uint* p, uint bitnum); 
     73int btr( uint* p, uint bitnum ); 
    7474 
    7575 
     
    130130</pre> 
    131131 */ 
    132 int bts(uint* p, uint bitnum); 
     132int bts( uint* p, uint bitnum ); 
    133133 
    134134 
     
    138138 * becomes byte 0. 
    139139 */ 
    140 uint bswap(uint v); 
     140uint bswap( uint v ); 
    141141 
    142142 
     
    144144 * Reads I/O port at port_address. 
    145145 */ 
    146 ubyte inp(uint port_address); 
     146ubyte inp( uint port_address ); 
    147147 
    148148 
     
    150150 * ditto 
    151151 */ 
    152 ushort inpw(uint port_address); 
     152ushort inpw( uint port_address ); 
    153153 
    154154 
     
    156156 * ditto 
    157157 */ 
    158 uint inpl(uint port_address); 
     158uint inpl( uint port_address ); 
    159159 
    160160 
     
    162162 * Writes and returns value to I/O port at port_address. 
    163163 */ 
    164 ubyte outp(uint port_address, ubyte value); 
     164ubyte outp( uint port_address, ubyte value ); 
    165165 
    166166 
     
    168168 * ditto 
    169169 */ 
    170 ushort outpw(uint port_address, ushort value); 
     170ushort outpw( uint port_address, ushort value ); 
    171171 
    172172 
     
    174174 * ditto 
    175175 */ 
    176 uint outpl(uint port_address, uint value); 
     176uint outpl( uint port_address, uint value ); 
  • trunk/tango/core/Array.d

    r738 r745  
    11/** 
    2  * The array module provides string manipulation routines in a manner that 
    3  * balances performance and flexibility. 
     2 * The array module provides array manipulation routines in a manner that 
     3 * balances performance and flexibility.  Operations are provides for sorting, 
     4 * and for processing both sorted and unsorted arrays. 
    45 * 
    56 * Copyright: Copyright (C) 2005-2006 Sean Kelly.  All rights reserved. 
     
    934935{ 
    935936    /** 
    936      * Performs a linear search of buf from $(LB)buf.length .. 0$(RP), 
     937     * Performs a linear search of buf from $(LP)buf.length .. 0$(RB), 
    937938     * returning the index of the first element where pred returns true. 
    938939     * 
  • trunk/tango/core/Intrinsic.di

    r454 r745  
    1111public import std.intrinsic; 
    1212 
     13 
     14version( DDoc ) 
     15{ 
     16    /** 
     17     * Scans the bits in v starting with bit 0, looking 
     18     * for the first set bit. 
     19     * Returns: 
     20     *  The bit number of the first bit set. 
     21     *  The return value is undefined if v is zero. 
     22     */ 
     23    int bsf( uint v ); 
     24 
     25 
     26    /** 
     27     * Scans the bits in v from the most significant bit 
     28     * to the least significant bit, looking 
     29     * for the first set bit. 
     30     * Returns: 
     31     *  The bit number of the first bit set. 
     32     *  The return value is undefined if v is zero. 
     33     * Example: 
     34     * --- 
     35     * import std.intrinsic; 
     36     * 
     37     * int main() 
     38     * { 
     39     *     uint v; 
     40     *     int x; 
     41     * 
     42     *     v = 0x21; 
     43     *     x = bsf(v); 
     44     *     printf("bsf(x%x) = %d\n", v, x); 
     45     *     x = bsr(v); 
     46     *     printf("bsr(x%x) = %d\n", v, x); 
     47     *     return 0; 
     48     * } 
     49     * --- 
     50     * Output: 
     51     *  bsf(x21) = 0<br> 
     52     *  bsr(x21) = 5 
     53     */ 
     54    int bsr( uint v ); 
     55 
     56 
     57    /** 
     58     * Tests the bit. 
     59     */ 
     60    int bt( uint* p, uint bitnum ); 
     61 
     62 
     63    /** 
     64     * Tests and complements the bit. 
     65     */ 
     66    int btc( uint* p, uint bitnum ); 
     67 
     68 
     69    /** 
     70     * Tests and resets (sets to 0) the bit. 
     71     */ 
     72    int btr( uint* p, uint bitnum ); 
     73 
     74 
     75    /** 
     76     * Tests and sets the bit. 
     77     * Params: 
     78     * p = a non-NULL pointer to an array of uints. 
     79     * index = a bit number, starting with bit 0 of p[0], 
     80     * and progressing. It addresses bits like the expression: 
     81    --- 
     82    p[index / (uint.sizeof*8)] & (1 << (index & ((uint.sizeof*8) - 1))) 
     83    --- 
     84     * Returns: 
     85     *  A non-zero value if the bit was set, and a zero 
     86     *  if it was clear. 
     87     * 
     88     * Example: 
     89     * --- 
     90    import std.intrinsic; 
     91 
     92    int main() 
     93    { 
     94        uint array[2]; 
     95 
     96        array[0] = 2; 
     97        array[1] = 0x100; 
     98 
     99        printf("btc(array, 35) = %d\n", <b>btc</b>(array, 35)); 
     100        printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]); 
     101 
     102        printf("btc(array, 35) = %d\n", <b>btc</b>(array, 35)); 
     103        printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]); 
     104 
     105        printf("bts(array, 35) = %d\n", <b>bts</b>(array, 35)); 
     106        printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]); 
     107 
     108        printf("btr(array, 35) = %d\n", <b>btr</b>(array, 35)); 
     109        printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]); 
     110 
     111        printf("bt(array, 1) = %d\n", <b>bt</b>(array, 1)); 
     112        printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]); 
     113 
     114        return 0; 
     115    } 
     116     * --- 
     117     * Output: 
     118    <pre> 
     119    btc(array, 35) = 0 
     120    array = [0]:x2, [1]:x108 
     121    btc(array, 35) = -1 
     122    array = [0]:x2, [1]:x100 
     123    bts(array, 35) = 0 
     124    array = [0]:x2, [1]:x108 
     125    btr(array, 35) = -1 
     126    array = [0]:x2, [1]:x100 
     127    bt(array, 1) = -1 
     128    array = [0]:x2, [1]:x100 
     129    </pre> 
     130     */ 
     131    int bts( uint* p, uint bitnum ); 
     132 
     133 
     134    /** 
     135     * Swaps bytes in a 4 byte uint end-to-end, i.e. byte 0 becomes 
     136     * byte 3, byte 1 becomes byte 2, byte 2 becomes byte 1, byte 3 
     137     * becomes byte 0. 
     138     */ 
     139    uint bswap( uint v ); 
     140 
     141 
     142    /** 
     143     * Reads I/O port at port_address. 
     144     */ 
     145    ubyte inp( uint port_address ); 
     146 
     147 
     148    /** 
     149     * ditto 
     150     */ 
     151    ushort inpw( uint port_address ); 
     152 
     153 
     154    /** 
     155     * ditto 
     156     */ 
     157    uint inpl( uint port_address ); 
     158 
     159 
     160    /** 
     161     * Writes and returns value to I/O port at port_address. 
     162     */ 
     163    ubyte outp( uint port_address, ubyte value ); 
     164 
     165 
     166    /** 
     167     * ditto 
     168     */ 
     169    ushort outpw( uint port_address, ushort value ); 
     170 
     171 
     172    /** 
     173     * ditto 
     174     */ 
     175    uint outpl( uint port_address, uint value ); 
     176}