toolsandutils/e32tools/elf2e32/source/pl_common.cpp
changeset 0 83f4b4db085c
child 1 d4b442d23379
equal deleted inserted replaced
-1:000000000000 0:83f4b4db085c
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implementation of the Class SymbolAttrib for the elf2e32 tool
       
    15 // @internalComponent
       
    16 // @released
       
    17 // 
       
    18 //
       
    19 
       
    20 #include <tools/elfdefs.h>
       
    21 #include "pl_common.h"
       
    22 
       
    23 
       
    24 VersionInfo::VersionInfo(): iSOName(0), iLinkAs(0), iVerCategory(VER_CAT_NONE) 
       
    25 {}
       
    26 
       
    27 VersionInfo::~VersionInfo()
       
    28 {}
       
    29 
       
    30 /**
       
    31 hash function for ELF symbols
       
    32 @param name
       
    33 @internalComponent
       
    34 @released
       
    35 */
       
    36 unsigned long Util::elf_hash(const unsigned char *name)
       
    37 {
       
    38 	unsigned long h, g;
       
    39 	for (h = 0; *name != 0; ++name)
       
    40 	{
       
    41 		h = (h << 4) + *name;
       
    42 		g = h & 0xf0000000;
       
    43 		if (g != 0) h ^= g >> 24;
       
    44 		h &= ~g;
       
    45 	}
       
    46 	return h;
       
    47 }