Commit b18a77f8 authored by Yiannis Tsiouris's avatar Yiannis Tsiouris

Fix a few more warnings

parent 627fc2cb
...@@ -45,6 +45,7 @@ credit c1 c2 = foldl (flip credit_atomic) c2 c1 ...@@ -45,6 +45,7 @@ credit c1 c2 = foldl (flip credit_atomic) c2 c1
-- represented by K' and C' equals the credit represented by C. -- represented by K' and C' equals the credit represented by C.
-- Precondition: C must represent non-zero credit. -- Precondition: C must represent non-zero credit.
debit_atomic :: Credit -> (ACredit, Credit) debit_atomic :: Credit -> (ACredit, Credit)
debit_atomic [] = error "Credit [] is not valid."
debit_atomic (c : cs) = (c, cs) -- debit smallest unit of credit debit_atomic (c : cs) = (c, cs) -- debit smallest unit of credit
-- debit_atomic_nz(C) returns a pair {K',C'} where K' is an integer -- debit_atomic_nz(C) returns a pair {K',C'} where K' is an integer
...@@ -53,6 +54,7 @@ debit_atomic (c : cs) = (c, cs) -- debit smallest unit of credit ...@@ -53,6 +54,7 @@ debit_atomic (c : cs) = (c, cs) -- debit smallest unit of credit
-- represented by K' and C' equals the credit represented by C. -- represented by K' and C' equals the credit represented by C.
-- Precondition: C must represent non-zero credit. -- Precondition: C must represent non-zero credit.
debit_atomic_nz :: Credit -> (ACredit, Credit) debit_atomic_nz :: Credit -> (ACredit, Credit)
debit_atomic_nz [] = error "Credit [] is not valid."
debit_atomic_nz [c] = (c + 1, [c + 1]) -- debit half the credit debit_atomic_nz [c] = (c + 1, [c + 1]) -- debit half the credit
debit_atomic_nz (c : cs) = (c, cs) -- debit smallest unit of credit; debit_atomic_nz (c : cs) = (c, cs) -- debit smallest unit of credit;
-- case only applies if Cs non-empty -- case only applies if Cs non-empty
......
...@@ -299,6 +299,7 @@ hash_vertex staticMachConf x = global_to_local_slot workers globalSlot ...@@ -299,6 +299,7 @@ hash_vertex staticMachConf x = global_to_local_slot workers globalSlot
-- Note: This procedure is horribly inefficient (linear in size of Workers); -- Note: This procedure is horribly inefficient (linear in size of Workers);
-- it should be log (size of Workers) at most. -- it should be log (size of Workers) at most.
global_to_local_slot :: [(ProcessId, Int, Int)] -> Int -> (ProcessId, Int) global_to_local_slot :: [(ProcessId, Int, Int)] -> Int -> (ProcessId, Int)
global_to_local_slot [] _ = error "global_to_local_slot cannot work on [] workers."
global_to_local_slot ((pid, _, tabSize) : workers) globSlot global_to_local_slot ((pid, _, tabSize) : workers) globSlot
| globSlot < tabSize = (pid, globSlot) | globSlot < tabSize = (pid, globSlot)
| otherwise = global_to_local_slot workers (globSlot - tabSize) | otherwise = global_to_local_slot workers (globSlot - tabSize)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment