4 internal class InternalUtils {
5 public static T[] check_arr_len<T>(T[] arr, int length) {
6 if (arr != null && arr.Length != length) {
7 throw new ArgumentException("Array must be of fixed size " + length + " but was of length " + arr.Length);
12 public static byte[] convUInt5Array(UInt5[] u5s) {
13 byte[] res = new byte[u5s.Length];
14 for (int i = 0; i < u5s.Length; i++) {
15 res[i] = u5s[i].getVal();
20 public static T[] mapArray<F, T>(F[] arr, Func<F, T> f) {
21 T[] ret = new T[arr.Length];
22 for (int i = 0; i < arr.Length; i++) ret[i] = f(arr[i]);