A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
yet another conversion+dungeon
[simgrid.git]
/
examples
/
msg
/
dht-kademlia
/
node.c
diff --git
a/examples/msg/dht-kademlia/node.c
b/examples/msg/dht-kademlia/node.c
index 385d0d6b499d97cb0bb0b0e511b768908d7fde80..2d8c22fd54ebf3426c3553547d8d025bfe2fc816 100644
(file)
--- a/
examples/msg/dht-kademlia/node.c
+++ b/
examples/msg/dht-kademlia/node.c
@@
-1,4
+1,4
@@
-/* Copyright (c) 2010, 2012-201
6
. The SimGrid Team.
+/* Copyright (c) 2010, 2012-201
7
. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
@@
-20,7
+20,7
@@
node_t node_init(unsigned int node_id)
node->id = node_id;
node->table = routing_table_init(node_id);
node->id = node_id;
node->table = routing_table_init(node_id);
- snprintf(node->mailbox,
MAILBOX_NAME_SIZE-1, "%d
", node_id);
+ snprintf(node->mailbox,
MAILBOX_NAME_SIZE - 1, "%u
", node_id);
node->find_node_failed = 0;
node->find_node_success = 0;
node->find_node_failed = 0;
node->find_node_success = 0;
@@
-116,19
+116,19
@@
unsigned int get_id_in_prefix(unsigned int id, unsigned int prefix)
if (prefix == 0) {
return 0;
} else {
if (prefix == 0) {
return 0;
} else {
- return (1
<< (prefix - 1
)) ^ id;
+ return (1
U << ((unsigned int)(prefix - 1)
)) ^ id;
}
}
/** @brief Returns the prefix of an identifier.
* The prefix is the id of the bucket in which the remote identifier xor our identifier should be stored.
}
}
/** @brief Returns the prefix of an identifier.
* The prefix is the id of the bucket in which the remote identifier xor our identifier should be stored.
- * @param id : bigunsigned int id to test
+ * @param id : big
unsigned int id to test
* @param nb_bits : key size
*/
unsigned int get_node_prefix(unsigned int id, unsigned int nb_bits)
{
* @param nb_bits : key size
*/
unsigned int get_node_prefix(unsigned int id, unsigned int nb_bits)
{
- unsigned int
j,
size = sizeof(unsigned int) * 8;
- for (j = 0; j < size; j++) {
+ unsigned int size = sizeof(unsigned int) * 8;
+ for (
unsigned int
j = 0; j < size; j++) {
if (((id >> (size - 1 - j)) & 0x1) != 0) {
return nb_bits - (j);
}
if (((id >> (size - 1 - j)) & 0x1) != 0) {
return nb_bits - (j);
}
@@
-139,7
+139,7
@@
unsigned int get_node_prefix(unsigned int id, unsigned int nb_bits)
/** @brief Gets the mailbox name of a host given its identifier */
void get_node_mailbox(unsigned int id, char *mailbox)
{
/** @brief Gets the mailbox name of a host given its identifier */
void get_node_mailbox(unsigned int id, char *mailbox)
{
- snprintf(mailbox,
MAILBOX_NAME_SIZE-1, "%d
", id);
+ snprintf(mailbox,
MAILBOX_NAME_SIZE - 1, "%u
", id);
}
/** Constructor, build a new contact information. */
}
/** Constructor, build a new contact information. */