| author | |
| committer | |
| log | 4b372230234b6ed12e62778972a1bf869e331743 |
| tree | 60e71360b486b4c3a27523f3258e754f911b791b |
| parent | e79b6d25a140d0a97a6ba0f88f504dd52ff42d29 |
1 files changed, 6 insertions(+), 0 deletions(-)
src/lib.zig+6| ... | ... | @@ -808,3 +808,9 @@ pub const AnyReader = struct { |
| 808 | 808 | } |
| 809 | 809 | } |
| 810 | 810 | }; |
| 811 | ||
| 812 | pub fn sum(comptime T: type, slice: []const T) T { | |
| 813 | var res: T = 0; | |
| 814 | for (slice) |item| res += item; | |
| 815 | return res; | |
| 816 | } |