sample-code: proper type annotations on HEX_LUT, add FIXME for min and max
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
//! Useful math functions
|
||||
|
||||
// FIXME:
|
||||
// These two functions shouldn't actually be polymorphic, but
|
||||
// the AST interpreter doesn't know about type annotations
|
||||
// or operator overloading.
|
||||
#[generic("T")]
|
||||
pub fn max(a: T, b: T) -> T {
|
||||
(if a < b { b } else { a })
|
||||
}
|
||||
|
||||
#[generic("T")]
|
||||
pub fn min(a: T, b: T) -> T {
|
||||
(if a > b { b } else { a })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user