Пример #1
0
        /// <summary>
        /// Creates a sequence of formatted views into an existing view.
        /// </summary>
        /// <param name="this">The existing view.</param>
        /// <param name="formats">The sequence of formats that the new views will have.</param>
        /// <returns></returns>
        public static IEnumerable <IBitWindow> Shatter(this IBitWindow @this, IEnumerable <IntegerFormat> formats)
        {
            Int32 pos = 0;

            foreach (var fmt in formats)
            {
                yield return(@this.Crack(pos, fmt.BitWidth, fmt.GetIndexer()));

                pos += fmt.BitWidth;
            }
        }
Пример #2
0
        /// <summary>
        /// Creates a sequence of views into an existing view.
        /// </summary>
        /// <param name="this">The existing view.</param>
        /// <param name="sizes">The sequence of view sizes.</param>
        /// <returns></returns>
        public static IEnumerable <IBitWindow> Shatter(this IBitWindow @this, IEnumerable <Int32> sizes)
        {
            Int32 pos = 0;

            foreach (var size in sizes)
            {
                yield return(@this.Crack(pos, size, @this.Indexer));

                pos += size;
            }
        }
Пример #3
0
 /// <summary>
 /// Creates a view into an existing view.
 /// </summary>
 /// <param name="this">The existing view.</param>
 /// <param name="offset">The bit offset relative to the start of the existing view.</param>
 /// <param name="format">A format to follow.</param>
 /// <returns></returns>
 public static IBitWindow Crack(this IBitWindow @this, Int32 offset, IntegerFormat format)
 {
     return(@this.Crack(offset, format.BitWidth, format.GetIndexer()));
 }