Changeset e2839d7 in mainline
- Timestamp:
- 2013-09-30T20:13:39Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 26de91a
- Parents:
- 159ad6d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inet/addr.c
r159ad6d re2839d7 79 79 } 80 80 81 /** Compare addr48. 82 * 83 * @return Non-zero if equal, zero if not equal. 84 */ 81 85 int addr48_compare(const addr48_t a, const addr48_t b) 82 86 { 83 return memcmp(a, b, 6); 84 } 85 87 return memcmp(a, b, 6) == 0; 88 } 89 90 /** Compare addr128. 91 * 92 * @return Non-zero if equal, zero if not equal. 93 */ 86 94 int addr128_compare(const addr128_t a, const addr128_t b) 87 95 { 88 return memcmp(a, b, 16) ;96 return memcmp(a, b, 16) == 0; 89 97 } 90 98 … … 103 111 void host2addr128_t_be(const addr128_t host, addr128_t be) 104 112 { 105 #ifdef __BE__106 113 memcpy(be, host, 16); 107 #else108 be[0] = host[15];109 be[1] = host[14];110 be[2] = host[13];111 be[3] = host[12];112 be[4] = host[11];113 be[5] = host[10];114 be[6] = host[9];115 be[7] = host[8];116 be[8] = host[7];117 be[9] = host[6];118 be[10] = host[5];119 be[11] = host[4];120 be[12] = host[3];121 be[13] = host[2];122 be[14] = host[1];123 be[15] = host[0];124 #endif125 114 } 126 115 127 116 void addr128_t_be2host(const addr128_t be, addr128_t host) 128 117 { 129 #ifdef __BE__130 118 memcpy(host, be, 16); 131 #else132 host[0] = be[15];133 host[1] = be[14];134 host[2] = be[13];135 host[3] = be[12];136 host[4] = be[11];137 host[5] = be[10];138 host[6] = be[9];139 host[7] = be[8];140 host[8] = be[7];141 host[9] = be[6];142 host[10] = be[5];143 host[11] = be[4];144 host[12] = be[3];145 host[13] = be[2];146 host[14] = be[1];147 host[15] = be[0];148 #endif149 119 } 150 120
Note:
See TracChangeset
for help on using the changeset viewer.