Skip to content

Commit

Permalink
Added more types to the switch statement to fix issue with using int6…
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavyWombat committed Jan 13, 2017
1 parent a2d606f commit e29880f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions assets/calc/dependencies.yml
@@ -1,10 +1,14 @@
---
meta:
target_mem: 144
extras: (( grab meta.custom-extras || 0 ))

jobs:
- name: big_ones
instances: (( calc "floor(meta.target_mem / 32)" ))

- name: small_ones
instances: (( calc "floor((meta.target_mem - jobs.big_ones.instances * 32) / 16)" ))

- name: extra_ones
instances: (( calc "2 + meta.extras" ))
2 changes: 2 additions & 0 deletions cmd/spruce/main_test.go
Expand Up @@ -774,6 +774,8 @@ z:
name: big_ones
- instances: 1
name: small_ones
- instances: 2
name: extra_ones
`)
})
Expand Down
4 changes: 2 additions & 2 deletions op_calc.go
Expand Up @@ -143,10 +143,10 @@ func replaceReferences(ev *Evaluator, input string) (string, error) {
DEBUG(" path/value: %s=%v", path, value)

switch value.(type) {
case int:
case int, uint8, uint16, uint32, uint64, int8, int16, int32, int64:
input = strings.Replace(input, path, fmt.Sprintf("%d", value), -1)

case float64:
case float32, float64:
input = strings.Replace(input, path, fmt.Sprintf("%f", value), -1)

case nil:
Expand Down

0 comments on commit e29880f

Please sign in to comment.