From eefa47b0f91416a3435102f89339b3ec4fcdd672 Mon Sep 17 00:00:00 2001 From: Mathias Hall-Andersen Date: Sun, 24 Sep 2017 21:35:25 +0200 Subject: Begin work on source address caching (linux) --- src/misc.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/misc.go') diff --git a/src/misc.go b/src/misc.go index d93849e..bbe0d68 100644 --- a/src/misc.go +++ b/src/misc.go @@ -29,6 +29,11 @@ func (a *AtomicBool) Set(val bool) { atomic.StoreInt32(&a.flag, flag) } +func toInt32(n uint32) int32 { + mask := uint32(1 << 31) + return int32(-(n & mask) + (n & ^mask)) +} + func min(a uint, b uint) uint { if a > b { return b -- cgit v1.2.3