os/kernelhwsrv/userlibandfileserver/fileserver/sfat/inc/sl_std.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/sfat/inc/sl_std.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,598 @@
     1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// f32\sfat\inc\sl_std.inl
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1.22 +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1.23 +//!!
    1.24 +//!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
    1.25 +//!!
    1.26 +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1.27 +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1.28 +
    1.29 +#ifndef SL_STD_INL
    1.30 +#define SL_STD_INL
    1.31 +
    1.32 +
    1.33 +
    1.34 +TBool IsPowerOf2(TUint32 aVal)
    1.35 +    {
    1.36 +    if (aVal==0)
    1.37 +        return EFalse;
    1.38 +
    1.39 +    return !(aVal & (aVal-1));
    1.40 +    }
    1.41 +
    1.42 +TUint32 Pow2(TUint32 aVal)
    1.43 +    {
    1.44 +        //ASSERT(aVal<32);
    1.45 +        return 1 << aVal;
    1.46 +    }
    1.47 +
    1.48 +
    1.49 +//---------------------------------------------------------------------------------------------------------------------------------
    1.50 +// class TEntryPos
    1.51 +TUint32 TEntryPos::Cluster() const 
    1.52 +    {
    1.53 +    return (TUint32) iCluster;
    1.54 +    }
    1.55 +
    1.56 +TUint32 TEntryPos::Pos() const 
    1.57 +    {
    1.58 +    return (TUint32) iPos;
    1.59 +    }
    1.60 +
    1.61 +TBool TEntryPos::operator==(const TEntryPos& aRhs) const
    1.62 +    {
    1.63 +    ASSERT(this != &aRhs);
    1.64 +    return (iCluster == aRhs.iCluster && iPos == aRhs.iPos);
    1.65 +    }
    1.66 +
    1.67 +
    1.68 +//---------------------------------------------------------------------------------------------------------------------------------
    1.69 +// class CFatMountCB
    1.70 +
    1.71 +inline TInt CFatMountCB::RootDirectorySector() const
    1.72 +    {return iVolParam.RootDirectorySector();}
    1.73 +
    1.74 +inline TUint CFatMountCB::RootDirEnd() const
    1.75 +    {return iVolParam.RootDirEnd();}
    1.76 +
    1.77 +inline TUint32 CFatMountCB::RootClusterNum() const
    1.78 +    {return iVolParam.RootClusterNum(); }        
    1.79 +
    1.80 +
    1.81 +inline TInt CFatMountCB::StartCluster(const TFatDirEntry & anEntry) const
    1.82 +    {return anEntry.StartCluster();}
    1.83 +
    1.84 +
    1.85 +
    1.86 +/**
    1.87 +returns true for root dir on Fat12/16 (fixed root dir versions of Fat). 
    1.88 +this function is used to handle special cases for reading/writing the root directory on FAT via the use of cluster zero.
    1.89 +
    1.90 +@param aEntry position on volume being queried
    1.91 +@return Whether Root dir position or not
    1.92 +*/
    1.93 +TBool CFatMountCB::IsRootDir(const TEntryPos &aEntry) const
    1.94 +    {return((aEntry.iCluster==0) ? (TBool)ETrue : (TBool)EFalse);}
    1.95 +
    1.96 +/**
    1.97 +Indicates the root directory cluster, For Fat12/16 root is always indicated by cluster number zero
    1.98 +@return The root cluster indicator
    1.99 +*/
   1.100 +TInt CFatMountCB::RootIndicator() const
   1.101 +    {return 0;}
   1.102 +
   1.103 +   
   1.104 +TBool CFatMountCB::Is16BitFat() const
   1.105 +    {return(iFatType == EFat16);}
   1.106 +
   1.107 +/** @return Log2 of cluster size on volume */
   1.108 +TInt CFatMountCB::ClusterSizeLog2() const
   1.109 +    {return(iVolParam.ClusterSizeLog2());}
   1.110 +
   1.111 +/** @return Log2 of media sector size  */
   1.112 +TInt CFatMountCB::SectorSizeLog2() const
   1.113 +    {return(iVolParam.SectorSizeLog2());}
   1.114 +
   1.115 +/** @return sector per cluster */
   1.116 +TInt CFatMountCB::SectorsPerCluster() const
   1.117 +    {return(1<<(iVolParam.ClusterSizeLog2()-iVolParam.SectorSizeLog2()));}
   1.118 +
   1.119 +/** @return the base position of a cluster */
   1.120 +TInt CFatMountCB::ClusterBasePosition() const
   1.121 +    {return(iFirstFreeByte);}
   1.122 +
   1.123 +/** @return the offset into a cluster of a byte address */
   1.124 +TInt CFatMountCB::ClusterRelativePos(TInt aPos) const
   1.125 +    {return(aPos&((1<<ClusterSizeLog2())-1));}
   1.126 +
   1.127 +/**
   1.128 +Calculates the maximum number of clusters
   1.129 +@return  maximum number of clusters
   1.130 +*/
   1.131 +TUint32 CFatMountCB::MaxClusterNumber() const
   1.132 +    {return(TotalSectors()>>(ClusterSizeLog2()-SectorSizeLog2()));}
   1.133 +
   1.134 +/** @return the the total sectors on volume */
   1.135 +TInt CFatMountCB::TotalSectors() const
   1.136 +    {return iVolParam.TotalSectors();}
   1.137 +
   1.138 +/** @return total size of a Fat in bytes */
   1.139 +TInt CFatMountCB::FatSizeInBytes() const
   1.140 +    {return iVolParam.FatSizeInBytes();}
   1.141 +
   1.142 +/** @return first sector of the Fat */
   1.143 +TUint32 CFatMountCB::FirstFatSector() const
   1.144 +    {return iVolParam.FirstFatSector();}
   1.145 +
   1.146 +/** @return the byte offset of the Fat */
   1.147 +TInt CFatMountCB::StartOfFatInBytes() const
   1.148 +    {return(FirstFatSector()<<SectorSizeLog2());}
   1.149 +
   1.150 +/** @return Number of Fats used by the volume */
   1.151 +TInt CFatMountCB::NumberOfFats() const
   1.152 +    {return iVolParam.NumberOfFats();}
   1.153 +
   1.154 +
   1.155 +/** @return refrence to the fat table owned by the mount */
   1.156 +CFatTable& CFatMountCB::FAT() const
   1.157 +    {return(*iFatTable);}
   1.158 +/**
   1.159 +Returns a refrence to the file system object owned by the coresponding TDrive for a drive used for creating subsession objects
   1.160 +@return refrence to file system object
   1.161 +*/
   1.162 +CFatFileSystem& CFatMountCB::FatFileSystem() const
   1.163 +    {return((CFatFileSystem&)Drive().FSys());}
   1.164 +
   1.165 +
   1.166 +/** @return  refrence to a raw disk object owned by the mount */
   1.167 +CRawDisk& CFatMountCB::RawDisk() const
   1.168 +    {return(*iRawDisk);}
   1.169 +
   1.170 +/**
   1.171 +@return ETrue if aCluster value is bad cluster marker defined in FAT specification
   1.172 +*/
   1.173 +TBool CFatMountCB::IsBadCluster(TInt aCluster) const
   1.174 +    {return Is16BitFat() ? aCluster==0xFFF7 : aCluster==0xFF7;}
   1.175 +
   1.176 +/**
   1.177 +Returns whether the current mount is running as rugged Fat or not, this is held in the file system object
   1.178 +@return Is rugged fat flag
   1.179 +*/
   1.180 +TBool CFatMountCB::IsRuggedFSys() const
   1.181 +    {return Drive().IsRugged();}
   1.182 +
   1.183 +/**
   1.184 +Sets the rugged flag in the file system object
   1.185 +@param Flag to set or clear the rugged flag
   1.186 +*/
   1.187 +void CFatMountCB::SetRuggedFSys(TBool aVal)
   1.188 +    {Drive().SetRugged(aVal);}
   1.189 +
   1.190 +/** @return the usable clusters count for a volume */
   1.191 +TUint32 CFatMountCB::UsableClusters() const
   1.192 +    {return(iUsableClusters);}
   1.193 +
   1.194 +
   1.195 +TUint CFatMountCB::StartOfRootDirInBytes() const
   1.196 +    {return iVolParam.RootDirectorySector()<<SectorSizeLog2();}
   1.197 +
   1.198 +
   1.199 +/** @return FAT type for this mount */
   1.200 +TFatType CFatMountCB::FatType() const
   1.201 +{
   1.202 +    return iFatType;
   1.203 +}
   1.204 +
   1.205 +CAsyncNotifier* CFatMountCB::Notifier() const
   1.206 +    {return iNotifier;} 
   1.207 +
   1.208 +
   1.209 +/**
   1.210 +    Set or reset Read Only mode for the mount.
   1.211 +    @param    aReadOnlyMode if ETrue, the mount will be set RO.
   1.212 +*/
   1.213 +void  CFatMountCB::SetReadOnly(TBool aReadOnlyMode) 
   1.214 +{
   1.215 +    iReadOnly = aReadOnlyMode;
   1.216 +}
   1.217 +
   1.218 +    
   1.219 +/**
   1.220 +    @return ETrue if the volume is in Read-Only state
   1.221 +*/
   1.222 +TBool CFatMountCB::ReadOnly(void) const
   1.223 +    {
   1.224 +    return iReadOnly;
   1.225 +    }
   1.226 +
   1.227 +/** @return state of the CFatMountCB*/
   1.228 +CFatMountCB::TFatMntState CFatMountCB::State() const 
   1.229 +    {
   1.230 +    return iState;
   1.231 +    }
   1.232 +
   1.233 +/** 
   1.234 +    Set state of the CFatMountCB
   1.235 +    @param  aState state to set
   1.236 +*/
   1.237 +void CFatMountCB::SetState(TFatMntState aState)
   1.238 +    {
   1.239 +    //__PRINT3(_L("#- CFatMountCB::SetState() drv:%d, %d->%d\n"),DriveNumber(),iState,aState);
   1.240 +    iState = aState;
   1.241 +    }
   1.242 +
   1.243 +
   1.244 +TFatDriveInterface& CFatMountCB::DriveInterface() const 
   1.245 +    {
   1.246 +    return (TFatDriveInterface&)iDriverInterface; 
   1.247 +    }
   1.248 +
   1.249 +const TFatConfig& CFatMountCB::FatConfig() const 
   1.250 +    {
   1.251 +    return iFatConfig;
   1.252 +    }
   1.253 +
   1.254 +//---------------------------------------------------------------------------------------------------------------------------------
   1.255 +/** 
   1.256 +Check if the XFileCreationHelper object is initialised.
   1.257 +*/
   1.258 +TBool CFatMountCB::XFileCreationHelper::IsInitialised() const 
   1.259 +    {
   1.260 +    return isInitialised;
   1.261 +    }
   1.262 +
   1.263 +/** 
   1.264 +Get number of new entries for file creation.
   1.265 +*/
   1.266 +TUint16 CFatMountCB::XFileCreationHelper::NumOfAddingEntries() const
   1.267 +    {
   1.268 +    ASSERT(isInitialised); 
   1.269 +    return iNumOfAddingEntries;
   1.270 +    }
   1.271 +
   1.272 +/** 
   1.273 +Get position of new entries for file creation.
   1.274 +*/
   1.275 +TEntryPos CFatMountCB::XFileCreationHelper::EntryAddingPos() const 
   1.276 +    {
   1.277 +    ASSERT(isInitialised); 
   1.278 +    return iEntryAddingPos;
   1.279 +    }
   1.280 +
   1.281 +/** 
   1.282 +Check if position of new entries has been found.
   1.283 +*/
   1.284 +TBool CFatMountCB::XFileCreationHelper::IsNewEntryPosFound() const 
   1.285 +    {
   1.286 +    ASSERT(isInitialised); 
   1.287 +    return isNewEntryPosFound;
   1.288 +    }
   1.289 +
   1.290 +/** 
   1.291 +Check if file name of the new file is a legal dos name.
   1.292 +*/
   1.293 +TBool CFatMountCB::XFileCreationHelper::IsTrgNameLegalDosName() const
   1.294 +    {
   1.295 +    ASSERT(isInitialised); 
   1.296 +    return isTrgNameLegalDosName;
   1.297 +    }
   1.298 +
   1.299 +/** 
   1.300 +Set entry position for new entries to be added.
   1.301 +*/
   1.302 +void CFatMountCB::XFileCreationHelper::SetEntryAddingPos(const TEntryPos& aEntryPos) 
   1.303 +    {
   1.304 +    iEntryAddingPos = aEntryPos;
   1.305 +    }
   1.306 +
   1.307 +/** 
   1.308 +Set condition if position of new entries has been found.
   1.309 +*/
   1.310 +void CFatMountCB::XFileCreationHelper::SetIsNewEntryPosFound(TBool aFound) 
   1.311 +    {
   1.312 +    isNewEntryPosFound = aFound;
   1.313 +    }
   1.314 +
   1.315 +
   1.316 +
   1.317 +//-------  debug methods
   1.318 +#ifdef  _DEBUG
   1.319 +/**
   1.320 +Debug function indicates whether write fails are active or not, for test
   1.321 +@return ETrue if write fails on or not
   1.322 +*/
   1.323 +TBool CFatMountCB::IsWriteFail()const
   1.324 +    {return(iIsWriteFail);}
   1.325 +/**
   1.326 +Switches write fails on or off, for test
   1.327 +@param aIsWriteFail set true or false to set write fails on or off
   1.328 +*/
   1.329 +void CFatMountCB::SetWriteFail(TBool aIsWriteFail)
   1.330 +    {iIsWriteFail=aIsWriteFail;}
   1.331 +
   1.332 +/** @return number of write fails to occur, for test */
   1.333 +TInt CFatMountCB::WriteFailCount()const
   1.334 +    {return(iWriteFailCount);}
   1.335 +
   1.336 +/**
   1.337 +Set the number of Write fails 
   1.338 +@param aFailCount number of write fails, for test
   1.339 +*/
   1.340 +void CFatMountCB::SetWriteFailCount(TInt aFailCount)
   1.341 +    {iWriteFailCount=aFailCount;}
   1.342 +
   1.343 +/** Decrement the number of write fails, for test */
   1.344 +void CFatMountCB::DecWriteFailCount()
   1.345 +    {--iWriteFailCount;}
   1.346 +
   1.347 +/** @return Error for a write failure, for test */
   1.348 +TInt CFatMountCB::WriteFailError()const
   1.349 +    {return iWriteFailError;}
   1.350 +
   1.351 +/**
   1.352 +Set the write fail error code, for test
   1.353 +@param aErrorValue The Error for a write fails
   1.354 +*/
   1.355 +void CFatMountCB::SetWriteFailError(TInt aErrorValue)
   1.356 +    {iWriteFailError=aErrorValue;}
   1.357 +
   1.358 +#endif
   1.359 +
   1.360 +
   1.361 +//---------------------------------------------------------------------------------------------------------------------------------
   1.362 +// class CFatFormatCB
   1.363 +
   1.364 +TBool CFatFormatCB::Is16BitFat() const
   1.365 +    {return(iFileSystemName==KFileSystemName16);}
   1.366 +
   1.367 +CFatMountCB& CFatFormatCB::FatMount()
   1.368 +    {return *(CFatMountCB*)&Mount();}
   1.369 +
   1.370 +/**
   1.371 +Returns the local drive used by the file systems from the owning mount
   1.372 +@return Pointer to the local drive 
   1.373 +*/
   1.374 +CProxyDrive* CFatFormatCB::LocalDrive()
   1.375 +    {return(FatMount().LocalDrive());}
   1.376 +
   1.377 +
   1.378 +//---------------------------------------------------------------------------------------------------------------------------------
   1.379 +// class CFatFileCB
   1.380 +
   1.381 +/**
   1.382 +Returns the owning mount from file object
   1.383 +
   1.384 +@return pointer to the owning mount object
   1.385 +*/
   1.386 +CFatMountCB& CFatFileCB::FatMount() const
   1.387 +    {return((CFatMountCB&)Mount());}
   1.388 +
   1.389 +/**
   1.390 +Returns the fat table used by the file system for this mount
   1.391 +
   1.392 +@return Refrence to the Fat table owned by the mount
   1.393 +*/
   1.394 +CFatTable& CFatFileCB::FAT()
   1.395 +    {return(FatMount().FAT());}
   1.396 +
   1.397 +/**
   1.398 +Position with in a cluster for a given address
   1.399 +
   1.400 +@param aPos Byte position 
   1.401 +*/
   1.402 +TInt CFatFileCB::ClusterRelativePos(TInt aPos)
   1.403 +    {return(FatMount().ClusterRelativePos(aPos));}
   1.404 +/**
   1.405 +Returns Log2 of cluster size from mount
   1.406 +
   1.407 +@return cluster size
   1.408 +*/
   1.409 +TInt CFatFileCB::ClusterSizeLog2()
   1.410 +    {return(FatMount().ClusterSizeLog2());}
   1.411 +
   1.412 +/*
   1.413 + Note: this replaces SeekIndex() which was only used in sl_mnt
   1.414 + to verify whether the seek index had been created/initialised
   1.415 +*/
   1.416 +inline TBool CFatFileCB::IsSeekIndex() const
   1.417 +{return (iSeekIndex==NULL?(TBool)EFalse:(TBool)ETrue); }
   1.418 +
   1.419 +
   1.420 +//---------------------------------------------------------------------------------------------------------------------------------
   1.421 +// class CFatDirCB
   1.422 +
   1.423 +/**
   1.424 +Returns the owning mount from directory object
   1.425 +
   1.426 +@return pointer to the owning mount object
   1.427 +*/
   1.428 +CFatMountCB& CFatDirCB::FatMount()
   1.429 +    {return((CFatMountCB&)Mount());}
   1.430 +
   1.431 +
   1.432 +
   1.433 +//---------------------------------------------------------------------------------------------------------------------------------
   1.434 +// class CFatTable
   1.435 +
   1.436 +TUint32 CFatTable::FreeClusters() const 
   1.437 +    {
   1.438 +    return iFreeClusters;
   1.439 +    }
   1.440 +
   1.441 +
   1.442 +TBool CFatTable::IsEof16Bit(TInt aCluster) const
   1.443 +    {return(aCluster>=0xFFF8 && aCluster<=0xFFFF);}
   1.444 +
   1.445 +TBool CFatTable::IsEof12Bit(TInt aCluster) const
   1.446 +    {return(aCluster>=0xFF8 && aCluster<=0xFFF);}
   1.447 +
   1.448 +TInt CFatTable::SectorSizeLog2() const
   1.449 +    {return(iOwner->SectorSizeLog2());}
   1.450 +
   1.451 +//---------------------------------------------------------------------------------------------------------------------------------
   1.452 +
   1.453 +inline TBool CFatTable::IsFat12() const 
   1.454 +    {
   1.455 +    return iFatType == EFat12;
   1.456 +    }
   1.457 +
   1.458 +inline TBool CFatTable::IsFat16() const 
   1.459 +    {
   1.460 +    return iFatType == EFat16;
   1.461 +    }
   1.462 +
   1.463 +inline TFatType CFatTable::FatType() const 
   1.464 +    {
   1.465 +    return iFatType;
   1.466 +    }
   1.467 +/**
   1.468 +@return Maximal number of addresable FAT entries. This value is taken from the owning mount
   1.469 +*/
   1.470 +inline TUint32 CFatTable::MaxEntries() const
   1.471 +    {
   1.472 +        ASSERT(iMaxEntries > 0);
   1.473 +        return iMaxEntries;
   1.474 +    }
   1.475 +
   1.476 +
   1.477 +// class TFatDriveInterface
   1.478 +TBool TFatDriveInterface::NotifyUser() const
   1.479 +    {return(iMount->GetNotifyUser());}
   1.480 +
   1.481 +
   1.482 +
   1.483 +//----------------------------------------------------------------------------------------------------
   1.484 +// class CRawDisk
   1.485 +
   1.486 +/**
   1.487 +    Get pointer to the directory cache interface. Any client that reads/writes directory entries 
   1.488 +    MUST do it via this interface.
   1.489 +    Default implementation returns NULL
   1.490 +
   1.491 +    @return     pointer to the MWTCacheInterface interface, or NULL if it is not present.
   1.492 +*/
   1.493 +MWTCacheInterface* CRawDisk::DirCacheInterface()
   1.494 +    {
   1.495 +    return NULL;
   1.496 +    }
   1.497 +
   1.498 +//--------------------------------------------------------------------------------------------------------------------------------- 
   1.499 +//-- class RBitVector
   1.500 +
   1.501 +/** @return size of the vector (number of bits) */
   1.502 +inline TUint32 RBitVector::Size() const
   1.503 +    {
   1.504 +    return iNumBits;
   1.505 +    } 
   1.506 +
   1.507 +/**
   1.508 +    Get a bit by index
   1.509 +    
   1.510 +    @param aIndex  index in a bit vector
   1.511 +    @return 0 if the bit at pos aIndex is 0, not zero otherwise
   1.512 +    @panic EIndexOutOfRange if aIndex is out of range
   1.513 +*/
   1.514 +inline TBool RBitVector::operator[](TUint32 aIndex) const
   1.515 +    {
   1.516 +    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
   1.517 +    return (ipData[WordNum(aIndex)] & (1<<BitInWord(aIndex)));
   1.518 +    }
   1.519 +
   1.520 +/**
   1.521 +    Set a bit at pos aIndex to '1'
   1.522 +    @param aIndex  index in a bit vector
   1.523 +    @panic EIndexOutOfRange if aIndex is out of range
   1.524 +*/
   1.525 +inline void RBitVector::SetBit(TUint32 aIndex)
   1.526 +    {
   1.527 +    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
   1.528 +    ipData[WordNum(aIndex)] |= (1<<BitInWord(aIndex));
   1.529 +    }
   1.530 +
   1.531 +/**
   1.532 +    Set a bit at pos aIndex to '0'
   1.533 +    @param aIndex  index in a bit vector
   1.534 +    @panic EIndexOutOfRange if aIndex is out of range
   1.535 +*/
   1.536 +inline void RBitVector::ResetBit(TUint32 aIndex)
   1.537 +    {
   1.538 +    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
   1.539 +    ipData[WordNum(aIndex)] &= ~(1<<BitInWord(aIndex));
   1.540 +    }
   1.541 +
   1.542 +/**
   1.543 +    Invert a bit at pos aIndex
   1.544 +    @param aIndex  index in a bit vector
   1.545 +    @panic EIndexOutOfRange if aIndex is out of range
   1.546 +*/
   1.547 +inline void RBitVector::InvertBit(TUint32 aIndex)
   1.548 +    {
   1.549 +    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
   1.550 +    ipData[WordNum(aIndex)] ^= (1<<BitInWord(aIndex));
   1.551 +    }
   1.552 +
   1.553 +/**
   1.554 +    Set bit value at position aIndex
   1.555 +    @param aIndex  index in a bit vector
   1.556 +    @panic EIndexOutOfRange if aIndex is out of range
   1.557 +*/
   1.558 +inline void RBitVector::SetBitVal(TUint32 aIndex, TBool aVal)
   1.559 +    {
   1.560 +    if(aVal) 
   1.561 +        SetBit(aIndex);
   1.562 +    else 
   1.563 +        ResetBit(aIndex);
   1.564 +    }
   1.565 +
   1.566 +
   1.567 +inline TUint32 RBitVector::MaskLastWord(TUint32 aVal) const
   1.568 +    {
   1.569 +    const TUint32 shift = (32-(iNumBits & 0x1F)) & 0x1F;
   1.570 +    return (aVal << shift) >> shift; //-- mask unused high bits
   1.571 +    }
   1.572 +
   1.573 +
   1.574 +
   1.575 +inline TUint32 RBitVector::WordNum(TUint32 aBitPos)  const
   1.576 +    {
   1.577 +    return aBitPos >> 5;
   1.578 +    }
   1.579 +
   1.580 +inline TUint32 RBitVector::BitInWord(TUint32 aBitPos) const 
   1.581 +    {
   1.582 +    return aBitPos & 0x1F;
   1.583 +    }
   1.584 +
   1.585 +/**
   1.586 +    Calculate offset of the page starting position in the cluster 
   1.587 +    @param aPos  the current entry position in bytes in the cluster
   1.588 +    @param aPageSzLog2  page size in log2
   1.589 +    @return     the starting position of the page that contains aPos
   1.590 +*/
   1.591 +inline TUint32 CalculatePageOffsetInCluster(TUint32 aPos, TUint aPageSzLog2)
   1.592 +    {
   1.593 +    return (aPos >> aPageSzLog2) << aPageSzLog2;
   1.594 +    }
   1.595 +
   1.596 +#endif //SL_STD_INL
   1.597 +
   1.598 +
   1.599 +
   1.600 +
   1.601 +