2 // This file is part of the aMule Project.
4 // Copyright (c) 2004-2008 Angel Vidal (Kry) ( kry@amule.org )
5 // Copyright (c) 2004-2008 aMule Team ( admin@amule.org / http://www.amule.org )
6 // Copyright (c) 2003 Barry Dunne (http://www.emule-project.net)
8 // Any parts of this program derived from the xMule, lMule or eMule project,
9 // or contributed by third-party developers are copyrighted by their
10 // respective authors.
12 // This program is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation; either version 2 of the License, or
15 // (at your option) any later version.
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 Please do not change anything here and release it..
30 There is going to be a new forum created just for the Kademlia side of the client..
31 If you feel there is an error or a way to improve something, please
32 post it in the forum first and let us look at it.. If it is a real improvement,
33 it will be added to the offical client.. Changing something without knowing
34 what all it does can cause great harm to the network if released in mass form..
35 Any mod that changes anything within the Kademlia side will not be allowed to advertise
36 there client on the eMule forum..
39 #include "LittleEndian.h"
44 static char THIS_FILE
[] = __FILE__
;
48 ////////////////////////////////////////
50 ////////////////////////////////////////
52 //NOTE: avoid those function whenever possible -> terribly slow
55 uint32 b0
= (val
) & 0xFF;
56 uint32 b1
= (val
>> 8) & 0xFF;
57 return (uint16
) ((b0
<< 8) | b1
);
60 //NOTE: avoid those function whenever possible -> terribly slow
63 uint32 b0
= (val
) & 0xFF;
64 uint32 b1
= (val
>> 8) & 0xFF;
65 uint32 b2
= (val
>> 16) & 0xFF;
66 uint32 b3
= (val
>> 24) & 0xFF;
67 return (b0
<< 24) | (b1
<< 16) | (b2
<< 8) | b3
;
70 //NOTE: avoid those function whenever possible -> terribly slow
73 uint32 b0
= (uint32
)((val
) & 0xFF);
74 uint32 b1
= (uint32
)((val
>> 8) & 0xFF);
75 uint32 b2
= (uint32
)((val
>> 16) & 0xFF);
76 uint32 b3
= (uint32
)((val
>> 24) & 0xFF);
77 uint32 b4
= (uint32
)((val
>> 32) & 0xFF);
78 uint32 b5
= (uint32
)((val
>> 40) & 0xFF);
79 uint32 b6
= (uint32
)((val
>> 48) & 0xFF);
80 uint32 b7
= (uint32
)((val
>> 56) & 0xFF);
81 return ((uint64
)b0
<< 56) | ((uint64
)b1
<< 48) | ((uint64
)b2
<< 40) | ((uint64
)b3
<< 32) |
82 ((uint64
)b4
<< 24) | ((uint64
)b5
<< 16) | ((uint64
)b6
<< 8) | (uint64
)b7
;
86 // File_checked_for_headers