Ignore:
Timestamp:
Jun 26, 2019, 11:42:37 AM (18 months ago)
Author:
alain
Message:

This version is a major evolution: The physical memory allocators,
defined in the kmem.c, ppm.c, and kcm.c files have been modified
to support remote accesses. The RPCs that were previously user
to allocate physical memory in a remote cluster have been removed.
This has been done to cure a dead-lock in case of concurrent page-faults.

This version 2.2 has been tested on a (4 clusters / 2 cores per cluster)
TSAR architecture, for both the "sort" and the "fft" applications.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/bits.h

    r457 r635  
    33 *
    44 * Author   Ghassan Almaless (2008,2009,2010,2011,2012)
    5  *          Alain Greiner    (2016)
     5 *          Alain Greiner    (2016,2017,2018,2019)
    66 *
    77 * Copyright (c) UPMC Sorbonne Universites
     
    189189
    190190/*********************************************************************************************
    191  * This function returns the number of bits to code a non-zero unsigned integer value.
    192  *********************************************************************************************
    193  * @ val   : value to analyse
    194  * @ returns number of bits
    195  ********************************************************************************************/
    196 static inline uint32_t bits_nr( uint32_t val )
    197 {
    198         register uint32_t i;
    199 
    200         for( i=0 ; val > 0 ; i++ )
    201                 val = val >> 1;
    202 
    203         return i;
    204 }
    205 
    206 /*********************************************************************************************
    207  * This function takes an unsigned integer value as input argument, and returns another
    208  * unsigned integer, that is the (base 2) logarithm of the smallest power of 2 contained
    209  * in the input value.
     191 * This function takes a positive integer <val> as input argument, and returns the smallest
     192 * integer <order> such as : 1<<order >= val.
     193 * In other words, <order> is the min number of bits to encode <val> values.
    210194 *********************************************************************************************
    211195 * @ val   : value to analyse
     
    214198static inline uint32_t bits_log2( uint32_t val )
    215199{
    216         return (val == 0) ? 1 : bits_nr( val ) - 1;
     200    uint32_t i;
     201
     202    if( val > 0 )
     203    {
     204        val--;
     205        for( i=0 ; val > 0 ; i++ ) val = val >> 1;
     206        return i;
     207    }
     208    return 0;
    217209}
    218210
Note: See TracChangeset for help on using the changeset viewer.