From 08c71627839a9134367db354c8255f7a720e1ff3 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Sat, 6 Dec 2008 18:46:00 +0000 Subject: Renamed OT_FLAG to OT_PEERFLAG to make code easier to read Introduced READ16/32 and WRITE16/32 makros to abstract loading/storing from unaligned addresses away on cpu's that can actually load/store everywhere Removed all unnecessary memmoves, especially where it only moved 6 bytes in inner loop. I replaced them with WRITE16/32(READ16/32()) makros --- ot_vector.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'ot_vector.c') diff --git a/ot_vector.c b/ot_vector.c index 7d2a1a9..154d1c8 100644 --- a/ot_vector.c +++ b/ot_vector.c @@ -16,9 +16,6 @@ #include "uint32.h" #include "uint16.h" -#define READ16(addr,offs) ((int16_t)uint16_read((offs)+(uint8_t*)(addr))) -#define READ32(addr,offs) ((int32_t)uint32_read((offs)+(uint8_t*)(addr))) - static int vector_compare_peer(const void *peer1, const void *peer2 ) { int32_t cmp = READ32(peer1,0) - READ32(peer2,0); if (cmp == 0) cmp = READ16(peer1,4) - READ16(peer2,4); @@ -166,7 +163,7 @@ int vector_remove_peer( ot_vector *vector, ot_peer *peer ) { match = binary_search_peer( peer, vector->data, vector->size, &exactmatch ); if( !exactmatch ) return 0; - exactmatch = ( OT_FLAG( match ) & PEER_FLAG_SEEDING ) ? 2 : 1; + exactmatch = ( OT_PEERFLAG( match ) & PEER_FLAG_SEEDING ) ? 2 : 1; memmove( match, match + 1, sizeof(ot_peer) * ( end - match - 1 ) ); vector->size--; -- cgit v1.2.3