sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: // Collection of common constants, utility functions, etc. for the file server and file systems. sl@0: // Definitions here must be filesystem-agnostic, i.e. generic enougs to be used by every file system sl@0: // sl@0: // This is the internal file and must not be exported. sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #include "filesystem_utils.h" sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: /** sl@0: Calculates the log2 of a number sl@0: sl@0: @param aNum Number to calulate the log two of sl@0: @return The log two of the number passed in sl@0: */ sl@0: TUint32 Log2(TUint32 aVal) sl@0: { sl@0: return Log2_inline(aVal); sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: Calculates number of '1' bits in the aVal sl@0: sl@0: @param aVal some value sl@0: @return number of '1' bits in the aVal sl@0: */ sl@0: TUint32 Count1Bits(TUint32 aVal) sl@0: { sl@0: return Count1Bits_inline(aVal); sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: Removes trailing dots from aName. sl@0: @return new string descriptor that may have its length adjusted sl@0: */ sl@0: TPtrC RemoveTrailingDots(const TDesC& aName) sl@0: { sl@0: TInt len = aName.Length(); sl@0: sl@0: while(len > 0) sl@0: { sl@0: if(aName[len-1] == '.') sl@0: len--; sl@0: else sl@0: break; sl@0: } sl@0: sl@0: TPtrC ptrNoDots(aName.Ptr(), len); sl@0: return ptrNoDots; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: