From a8c60ed28926be9c05a92aba772adda594e2d877 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 27 Sep 2017 06:32:48 +0930 Subject: [PATCH] towire: remove useless double-invert in towire_bool. GCC optimizes it out anyway: I sent an uninitialized var and it sent 8! The receiver checks the value is 0 or 1 anyway. Signed-off-by: Rusty Russell --- wire/towire.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wire/towire.c b/wire/towire.c index eec8fbae2..62ddca0f1 100644 --- a/wire/towire.c +++ b/wire/towire.c @@ -40,7 +40,7 @@ void towire_u64(u8 **pptr, u64 v) void towire_bool(u8 **pptr, bool v) { - u8 val = !!v; + u8 val = v; towire(pptr, &val, sizeof(val)); }