Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: João Pereira <[email protected]>
  • Loading branch information
mlimbeck and jcp19 authored Nov 22, 2023
1 parent b051f09 commit 7cbe9d6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions router/dataplane_spec.gobra
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ pure func infoFieldOffset(currINF int) int {
ghost
decreases
pure func hopFieldOffset(numINF int, currHF int) int {
return 4 + 8 * numINF + 12 * currHF
return infoFieldOffset(numINF) + 12 * currHF
}


Expand Down Expand Up @@ -531,7 +531,8 @@ ghost
requires -1 <= currHFIdx && currHFIdx < len(hopfields)
decreases currHFIdx + 1
pure func getSegPast(hopfields seq[io.IO_HF], currHFIdx int) seq[io.IO_HF]{
return currHFIdx == -1 ? seq[io.IO_HF]{} :
return currHFIdx == -1 ?
seq[io.IO_HF]{} :
seq[io.IO_HF]{hopfields[currHFIdx]} ++ getSegPast(hopfields, currHFIdx - 1)
}

Expand Down Expand Up @@ -803,9 +804,13 @@ requires forall idx int :: {hopfields[idx]} 0 <= idx && idx < len(hopfields) ==>
len(hopfields[idx].HVF.MsgTerm_Hash_.MsgTerm_MPair_2.MsgTerm_L_) > 0
decreases
pure func getUInfo(hopfields seq[io.IO_HF], currHFIdx int, consDir bool) set[io.IO_msgterm]{
return currHFIdx == len(hopfields) ? getHVFSet(hopfields[currHFIdx-1]) :
currHFIdx == 0 ? getHVFSet(hopfields[currHFIdx]) :
consDir ? getHVFSet(hopfields[currHFIdx]) : getHVFSet(hopfields[currHFIdx-1])
return currHFIdx == len(hopfields) ?
getHVFSet(hopfields[currHFIdx-1]) :
(currHFIdx == 0 ?
getHVFSet(hopfields[currHFIdx]) :
(consDir ?
getHVFSet(hopfields[currHFIdx]) :
getHVFSet(hopfields[currHFIdx-1]))
}

/** End of io-spec helper functions **/

0 comments on commit 7cbe9d6

Please sign in to comment.