forked from Velocidex/go-yara
/
util.go
35 lines (32 loc) · 770 Bytes
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright © 2015-2017 Hilko Bengen <bengen@hilluzination.de>
// All rights reserved.
//
// Use of this source code is governed by the license that can be
// found in the LICENSE file.
package yara
var callbackData = makecbPool(256)
func toint64(number interface{}) int64 {
switch number.(type) {
case int:
return int64(number.(int))
case int8:
return int64(number.(int8))
case int16:
return int64(number.(int16))
case int32:
return int64(number.(int32))
case int64:
return int64(number.(int64))
case uint:
return int64(number.(uint))
case uint8:
return int64(number.(uint8))
case uint16:
return int64(number.(uint16))
case uint32:
return int64(number.(uint32))
case uint64:
return int64(number.(uint64))
}
panic("wrong number")
}