public static (CodePoint cp, byte count) TryDecode(ArrayAccessor buffer, int index) { if (index >= buffer.Length) { return(Constants.End); } uint x = buffer[index++]; if ((x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000) { var code = (x & 0b0011_1111_1111) + 0b0100_0000; if (index >= buffer.Length) { return(Constants.End); } x = buffer[index++]; if ((x & 0b1111_1100_0000_0000) != 0b1101_1100_0000_0000) { return(Constants.End); } code = (code << 10) | (x & 0b0011_1111_1111); return(new CodePoint(code), 2); }
public static (CodePoint cp, byte count) TryDecode(ArrayAccessor buffer, int index) { if (index >= buffer.Length) { return(Constants.End); } return(new CodePoint(buffer[index]), 1); }
public static byte TyrGetCount(ArrayAccessor buffer, int index) { if (index >= buffer.Length) { return(Constants.InvalidCount); } return(1); }
public static byte TyrGetCount(ArrayAccessor buffer, int index) { if (index >= buffer.Length) return Constants.InvalidCount; uint x = buffer[index]; var count = (x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000 ? (byte)2 : (byte)1; if (index + count > buffer.Length) return Constants.InvalidCount; return count; }
internal static ArrayAccessor FromPointer(SWIGTYPE_p_p_int t, int length, int count) { global::System.IntPtr cPtr = fannfixedPINVOKE.IntArrayAccessor_FromPointer(SWIGTYPE_p_p_int.getCPtr(t)); ArrayAccessor ret = (cPtr == global::System.IntPtr.Zero) ? null : new ArrayAccessor(cPtr, false); ret.ArrayLength = length; ret.ArrayCount = count; return(ret); }
public static int GetLength(ArrayAccessor buffer) { var count = 0; for (int i = 0; i < buffer.Length; i++) { var x = buffer[i]; if ((x & 0b1111_1100_0000_0000) != 0b1101_1100_0000_0000) count++; } return count; }
public static byte TyrGetCount(ArrayAccessor buffer, int index) { if (index >= buffer.Length) return Constants.InvalidCount; uint x = buffer[index]; if ((x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000) { if (index + 1 >= buffer.Length) return Constants.InvalidCount; return 2; } else return 1; }
public static int GetLength(ArrayAccessor buffer) { var count = 0; for (int i = 0; i < buffer.Length; i++) { var x = buffer[i]; if ((x & 0b1111_1100_0000_0000) != 0b1101_1100_0000_0000) { count++; } } return(count); }
public BindingMemberInfo(string path, Type type) : this(path, BindingMemberType.Array, type.GetElementType()) { var indexes = BindingReflectionExtensions .GetIndexerValues(path, null, typeof(int)) .ToArrayEx(o => (int)o); var arrayAccessor = new ArrayAccessor(indexes); _getValueAccessorSingle = arrayAccessor.GetValue; _setValueAccessorSingleAction = arrayAccessor.SetValue; _canRead = true; _canWrite = true; _isSingleParameter = true; }
public static byte TyrGetCount(ArrayAccessor buffer, int index) { if (index >= buffer.Length) { return(Constants.InvalidCount); } uint x = buffer[index]; var count = (x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000 ? (byte)2 : (byte)1; if (index + count > buffer.Length) { return(Constants.InvalidCount); } return(count); }
public static CodePoint Decode(ArrayAccessor buffer, Index index) { var i = index.index; uint x = buffer[i]; if (index.count == 2) { var code = (x & 0b0011_1111_1111) + 0b0100_0000; code = (code << 10) | ((uint)buffer[i + 1] & 0b0011_1111_1111); return new CodePoint(code); } else { return new CodePoint(x); } }
public static byte TyrGetCount(ArrayAccessor buffer, int index) { if (index >= buffer.Length) { return(Constants.InvalidCount); } uint x = buffer[index]; if ((x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000) { if (index + 1 >= buffer.Length) { return(Constants.InvalidCount); } return(2); }
public static CodePoint Decode(ArrayAccessor buffer, Index index) { var i = index.index; uint x = buffer[i]; if (index.count == 2) { var code = (x & 0b0011_1111_1111) + 0b0100_0000; code = (code << 10) | ((uint)buffer[i + 1] & 0b0011_1111_1111); return(new CodePoint(code)); } else { return(new CodePoint(x)); } }
public static (CodePoint cp, byte count) TryDecode(ArrayAccessor buffer, int index) { if (index >= buffer.Length) return Constants.End; uint x = buffer[index++]; if ((x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000) { var code = (x & 0b0011_1111_1111) + 0b0100_0000; if (index >= buffer.Length) return Constants.End; x = buffer[index++]; if ((x & 0b1111_1100_0000_0000) != 0b1101_1100_0000_0000) return Constants.End; code = (code << 10) | (x & 0b0011_1111_1111); return (new CodePoint(code), 2); } else { return (new CodePoint(x), 1); } }
public static int GetLength(ArrayAccessor buffer) => buffer.Length;
public static CodePoint Decode(ArrayAccessor buffer, Index index) => new CodePoint(buffer[index.index]);
public static byte TyrGetCount(ArrayAccessor buffer, int index) { if (index >= buffer.Length) return Constants.InvalidCount; return 1; }
public static (CodePoint cp, byte count) TryDecode(ArrayAccessor buffer, int index) { if (index >= buffer.Length) return Constants.End; return (new CodePoint(buffer[index]), 1); }
public static T[] GetInternalArray <T>(this List <T> list) => ArrayAccessor <T> .Getter(list);
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ArrayAccessor obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
/// <summary> /// Gets the internal array of a <see cref="List{T}"/>. /// <para>Warning: Internal array length >= List.Count. Use with cautious.</para> /// </summary> /// <typeparam name="T">The type of the elements.</typeparam> /// <param name="list">The respective list.</param> /// <returns>The internal array of the list.</returns> public static T[] GetInternalArray <T>(this List <T> list) { return(ArrayAccessor <T> .Getter(list)); }