Exemplo n.º 1
0
 /// <summary>
 /// Returns the domain for the 'domain_type' and 'fork_version'
 /// </summary>
 public Domain ComputeDomain(DomainType domainType, ForkVersion forkVersion = new ForkVersion())
 {
     Span<byte> combined = stackalloc byte[Domain.Length];
     domainType.AsSpan().CopyTo(combined);
     forkVersion.AsSpan().CopyTo(combined.Slice(DomainType.Length));
     return new Domain(combined);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the domain for the 'domain_type' and 'fork_version'
        /// </summary>
        public Domain ComputeDomain(DomainType domainType, ForkVersion forkVersion = new ForkVersion())
        {
            Span <byte> combined = new Span <byte>(new byte[Domain.Length]);

            BinaryPrimitives.WriteUInt32LittleEndian(combined, (uint)domainType);
            forkVersion.AsSpan().CopyTo(combined.Slice(sizeof(DomainType)));
            return(new Domain(combined));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns the domain for the 'domain_type' and 'fork_version'
        /// </summary>
        public Domain ComputeDomain(DomainType domainType, ForkVersion forkVersion = new ForkVersion())
        {
            var combined = new Span <byte>(new byte[Domain.Length]);

            domainType.AsSpan().CopyTo(combined);
            forkVersion.AsSpan().CopyTo(combined.Slice(DomainType.Length));
            return(new Domain(combined));
        }
Exemplo n.º 4
0
 public static SszElement ToSszBasicVector(this ForkVersion item)
 {
     return(new SszBasicVector(item.AsSpan()));
 }
Exemplo n.º 5
0
 private static void Encode(Span <byte> span, ForkVersion value, ref int offset)
 {
     // FIXME: ForkVersion can be created by marshalling a span onto it, with no guarantee the underlying architecture is little endian.
     value.AsSpan().CopyTo(span.Slice(offset, ForkVersionLength));
     offset += ForkVersionLength;
 }
Exemplo n.º 6
0
 public static void Encode(Span <byte> span, ForkVersion value)
 {
     value.AsSpan().CopyTo(span);
 }