From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Marek Lindner Date: Sat, 11 Feb 2012 21:59:57 +0800 References: <1328830902-11574-1-git-send-email-ordex@autistici.org> <1328830902-11574-4-git-send-email-ordex@autistici.org> In-Reply-To: <1328830902-11574-4-git-send-email-ordex@autistici.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201202112159.58282.lindner_marek@yahoo.de> Subject: Re: [B.A.T.M.A.N.] [PATCHv5 3/9] batman-adv: Distributed ARP Table - create DHT helper functions Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: The list for a Better Approach To Mobile Ad-hoc Networking On Friday, February 10, 2012 07:41:36 Antonio Quartulli wrote: > + for (select = 0; select < DHT_CANDIDATES_NUM; select++) { > + max = 0; > + max_orig_node = NULL; > + if (!chosen_me) { > + /* if true, wrap around the key space */ > + if (bat_priv->dht_hash > ip_key) > + max = DAT_ADDR_MAX - bat_priv->dht_hash + > + ip_key; > + else > + max = ip_key - bat_priv->dht_hash; > + max = bat_priv->dht_hash; Somehow this does not make sense to me. Why do we calculate a magic value for "max" if we set it to bat_priv->dht_hash afterwards ? Moreover, the name dht_hash is a bit confusing. At first I thought it is a pointer to a hash (read: orig_hash/tt_local_hash/tt_global_hash/etc). Perhaps the comment should explain what and why the magic is supposed to achieve instead of stating what the c code is obviously doing ? Cheers, Marek