summaryrefslogtreecommitdiffhomepage
path: root/src/misc.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-09-24 21:35:25 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-09-24 21:35:25 +0200
commiteefa47b0f91416a3435102f89339b3ec4fcdd672 (patch)
tree704e1f38f5e0cf8bba15607c16f2e2d1c23baedb /src/misc.go
parentc545d63bb93b8192dfdc7037952fc2661dd1222b (diff)
Begin work on source address caching (linux)
Diffstat (limited to 'src/misc.go')
-rw-r--r--src/misc.go5
1 files changed, 5 insertions, 0 deletions
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