MCPcopy Index your code
hub / github.com/expr-lang/expr / ToInt

Function ToInt

vm/runtime/runtime.go:323–352  ·  view source on GitHub ↗
(a any)

Source from the content-addressed store, hash-verified

321}
322
323func ToInt(a any) int {
324 switch x := a.(type) {
325 case float32:
326 return int(x)
327 case float64:
328 return int(x)
329 case int:
330 return x
331 case int8:
332 return int(x)
333 case int16:
334 return int(x)
335 case int32:
336 return int(x)
337 case int64:
338 return int(x)
339 case uint:
340 return int(x)
341 case uint8:
342 return int(x)
343 case uint16:
344 return int(x)
345 case uint32:
346 return int(x)
347 case uint64:
348 return int(x)
349 default:
350 panic(fmt.Sprintf("invalid operation: int(%T)", x))
351 }
352}
353
354func ToInt64(a any) int64 {
355 switch x := a.(type) {

Callers 5

getFunction · 0.92
builtin.goFile · 0.92
RunMethod · 0.92
FetchFunction · 0.85
SliceFunction · 0.85

Calls 1

SprintfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…