// Int16Shrinker is a shrinker for int16 numbers
508281
func Int16Shrinker(v interface{}) gopter.Shrink {
	return Int64Shrinker(int64(v.(int16))).Map(int64To16)
}
1004841
func Int64R() (int64, error) {
	i, err := randDevInt64("/dev/random")
	return i, e.Forward(err)
}
1011431
func (rc *runContainer16) selectInt16(j uint16) int {
	n := rc.cardinality()
	if int64(j) > n {
		panic(fmt.Sprintf("Cannot select %v since Cardinality is %v", j, n))
	}

	var offset int64
	for k := range rc.iv {
		nextOffset := offset + rc.iv[k].runlen() + 1
		if nextOffset > int64(j) {
			return int(int64(rc.iv[k].start) + (int64(j) - offset))
		}
		offset = nextOffset
	}
	panic(fmt.Sprintf("Cannot select %v since Cardinality is %v", j, n))
}
762349
func (vb *packer) WriteInt16(num int16) (int, error) {
	return vb.WriteUint16(uint16(num))
}
570074
func (g Gen) WithShrinker(shrinker Shrinker) Gen {
	return func(genParams *GenParameters) *GenResult {
		result := g(genParams)
		if shrinker == nil {
			result.Shrinker = NoShrinker
		} else {
			result.Shrinker = shrinker
		}
		return result
	}
}
830871
func (enc *Encoder) Int16KeyNullEmpty(key string, v int16) {
	enc.Int64KeyNullEmpty(key, int64(v))
}
1254305
func (Encoder) AppendInts16(dst []byte, vals []int16) []byte {
	if len(vals) == 0 {
		return append(dst, '[', ']')
	}
	dst = append(dst, '[')
	dst = strconv.AppendInt(dst, int64(vals[0]), 10)
	if len(vals) > 1 {
		for _, val := range vals[1:] {
			dst = strconv.AppendInt(append(dst, ','), int64(val), 10)
		}
	}
	dst = append(dst, ']')
	return dst
}
463713
func (a *Array) Uint16(i uint16) *Array {
	a.buf = enc.AppendUint16(enc.AppendArrayDelim(a.buf), i)
	return a
}
832690
func TryToUint16(i interface{}) (r uint16, err error) {
	switch t := i.(type) {
	case nil:
		r = 0
	case uint:
		r = uint16(t)
	case uint8:
		r = uint16(t)
	case uint16:
		r = t
	case *uint16:
		r = *t
	case uint32:
		r = uint16(t)
	case uint64:
		r = uint16(t)
	case int:
		r = uint16(t)
	case int8:
		r = uint16(t)
	case int16:
		r = uint16(t)
	case int32:
		r = uint16(t)
	case int64:
		r = uint16(t)
	case float32:
		r = uint16(t)
	case float64:
		r = uint16(t)
	case bool:
		if t {
			r = 1
		}
	case string:
		var v uint64
		if v, err = strconv.ParseUint(t, 10, 16); err == nil {
			r = uint16(v)
		}
	default:
		err = castError(i, "uint16")
	}
	return
}
181787
func StringToInt16(from string) (int16, error) {
	val, err := strconv.ParseInt(from, DefeultNumericBase, 16)
	return int16(val), err
}
992286
func (m *Manager) GetInt16(key string) int16 {
	return cast.ToInt16(m.Get(key))
}
1128941
func (b *readBuf) int16() (n int) {
	n = int(binary.BigEndian.Uint16(*b))
	*b = (*b)[2:]
	return
}
955181
func (r *MockResult) Int16(i int) int16 {
	if r.Contains(i) {
		return r.Result[i].(int16)
	} else {
		return 0
	}
}
432076
func (i *Int32) Int32Or(or int32) int32 {
	if i == nil {
		return or
	}
	if !i.Valid {
		return or
	}

	return i.Int32
}
990626
func structMaxAttrID(v reflect.Value) (uint16, error) {
	if v.Kind() != reflect.Struct {
		return 0, fmt.Errorf("%v is not a struct", v.Type())
	}
	st := v.Type()

	var maxAttrID uint16
	for i := 0; i < st.NumField(); i++ {
		ft, fv := st.Field(i), v.Field(i)
		fp, err := parseFieldParams(ft.Tag.Get("netlink"))
		if err != nil {
			return 0, err
		}
		if fp != nil && fp.attr > maxAttrID {
			maxAttrID = fp.attr
		}
		if fp == nil && fv.Kind() == reflect.Struct {
			attrID, err := structMaxAttrID(fv)
			if err != nil {
				return 0, err
			}
			if attrID > maxAttrID {
				maxAttrID = attrID
			}
		}
	}
	return maxAttrID, nil
}
212478
func Len16(x uint16) (n int) {
	if x >= 1<<8 {
		x >>= 8
		n = 8
	}
	return n + int(len8tab[x])
}
22186
func asciiHex16(n int) []byte {
	var ret [4]byte
	ret[0] = byteToASCIIHex(byte(n & 0xf000 >> 12))
	ret[1] = byteToASCIIHex(byte(n & 0x0f00 >> 8))
	ret[2] = byteToASCIIHex(byte(n & 0x00f0 >> 4))
	ret[3] = byteToASCIIHex(byte(n & 0x000f))

	return ret[:]
}