summaryrefslogtreecommitdiff
path: root/toxcore/util.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-12 21:37:58 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-13 01:07:02 +0100
commita8823830d39bdbde8d4f4f34bfcb26dc4bf79741 (patch)
tree086d51b0db42c8fdbef669d002739f607db52f01 /toxcore/util.c
parent0aa2840164fc782f150cd45f8668ca623e6002cf (diff)
Add some astyle options to make it do more.
It now enforces a bit more formatting. In particular, padding inside parentheses is removed. I would like it to remove padding after unary operators, but there seems to be no option for that.
Diffstat (limited to 'toxcore/util.c')
-rw-r--r--toxcore/util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toxcore/util.c b/toxcore/util.c
index 40bf2849..f9fe7852 100644
--- a/toxcore/util.c
+++ b/toxcore/util.c
@@ -86,7 +86,7 @@ void host_to_net(uint8_t *num, uint16_t numbytes)
86uint16_t lendian_to_host16(uint16_t lendian) 86uint16_t lendian_to_host16(uint16_t lendian)
87{ 87{
88#ifdef WORDS_BIGENDIAN 88#ifdef WORDS_BIGENDIAN
89 return (lendian << 8) | (lendian >> 8 ); 89 return (lendian << 8) | (lendian >> 8);
90#else 90#else
91 return lendian; 91 return lendian;
92#endif 92#endif
@@ -95,7 +95,7 @@ uint16_t lendian_to_host16(uint16_t lendian)
95void host_to_lendian32(uint8_t *dest, uint32_t num) 95void host_to_lendian32(uint8_t *dest, uint32_t num)
96{ 96{
97#ifdef WORDS_BIGENDIAN 97#ifdef WORDS_BIGENDIAN
98 num = ((num << 8) & 0xFF00FF00 ) | ((num >> 8) & 0xFF00FF ); 98 num = ((num << 8) & 0xFF00FF00) | ((num >> 8) & 0xFF00FF);
99 num = (num << 16) | (num >> 16); 99 num = (num << 16) | (num >> 16);
100#endif 100#endif
101 memcpy(dest, &num, sizeof(uint32_t)); 101 memcpy(dest, &num, sizeof(uint32_t));
@@ -106,7 +106,7 @@ void lendian_to_host32(uint32_t *dest, const uint8_t *lendian)
106 uint32_t d; 106 uint32_t d;
107 memcpy(&d, lendian, sizeof(uint32_t)); 107 memcpy(&d, lendian, sizeof(uint32_t));
108#ifdef WORDS_BIGENDIAN 108#ifdef WORDS_BIGENDIAN
109 d = ((d << 8) & 0xFF00FF00 ) | ((d >> 8) & 0xFF00FF ); 109 d = ((d << 8) & 0xFF00FF00) | ((d >> 8) & 0xFF00FF);
110 d = (d << 16) | (d >> 16); 110 d = (d << 16) | (d >> 16);
111#endif 111#endif
112 *dest = d; 112 *dest = d;