Explorer

core.decode-digits

description
Reads the decimal digits from index on into value (value * 10 + digit for each digit). next is the index after the digits. For core.decode-value
type
Fn(bytes: List<Number>, index: Number, value: Number) -> Record{value: Number, next: Number}
expression
fn(bytes$0, index$1, value$2) =>
  match @core.list-get(list: $0, index: $1) {
    #some(byte$3) =>
      match @core.and(
          left: @core.less-than-or-equal(left: 48, right: $3),
          right: @core.less-than-or-equal(left: $3, right: 57)
        ) {
        true =>
          @core.decode-digits(
            bytes: $0,
            index: @core.plus(left: $1, right: 1),
            value: @core.plus(left: @core.multiply(left: $2, right: 10), right: @core.minus(left: $3, right: 48))
          ),
        false =>
          {value: $2, next: $1}
      },
    #none(_) =>
      {value: $2, next: $1}
  }
visibility
public
core.decode-digits (project definy, branch quote-encoded-parts, snapshot LbKb9vIRs5vdtsu6TiOqZ_NMUZJ6k1s6WlbZOc6x3-I)
id: c6ZrVe1zQV9MrjtChSFAw7iZHmu4Sqv6oAaZpFt9qYY
content hash: v6i6U9xB7XkfyYjso8e5qoJEDwm8BQHu03z21laPdlY