// FormInt32 returns request form as int32 with default
516007
func (ctx *Context) FormInt32(key string, defaults ...int32) int32 {
	return (*Forms)(ctx.req).MustInt32(key, defaults...)
}
1179719
func varint32(value int) []byte {
	buf := make([]byte, binary.MaxVarintLen32)
	n := binary.PutUvarint(buf, uint64(value))
	return buf[:n]
}
883042
func (w *ByteWriter) WriteInt32(val int32, offset int) (int, error) {
	return w.WriteVal(val, offset)
}
1213668
func (f *Forms) Float32(key string) (float32, error) {
	v, err := strconv.ParseFloat((*http.Request)(f).FormValue(key), 64)
	return float32(v), err
}
1066383
func WriteInt32(w io.Writer, val int32) (n int, err error) {
	return WriteUint32(w, uint32(val))
}
200706
func (w *Writer) WriteInt32(sample int32) error {
	err := binary.Write(w.sampleBuf, binary.LittleEndian, sample)
	if err != nil {
		return err
	}

	w.bytesWritten += 4

	return err
}
1237979
func ValidateInt(r *http.Request, name string, minmax ...int64) bool {
	value := r.FormValue(name)
	if value == "" {
		return false
	}

	if intValue, err := strconv.ParseInt(value, 10, 64); err != nil {
		return false
	} else {
		if len(minmax) > 0 {
			if intValue < minmax[0] {
				return false
			}
		}
		if len(minmax) > 1 {
			if intValue > minmax[1] {
				return false
			}
		}
	}
	return true
}
1268753
func Int32(b []byte) int32 {
	if l := len(b); l != 4 {
		panic(fmt.Sprintf("Int32: unexpected byte slice length: %d", l))
	}

	return *(*int32)(unsafe.Pointer(&b[0]))
}
268205
func (c Context) Ints32(key string, i []int32) Context {
	c.l.context = enc.AppendInts32(enc.AppendKey(c.l.context, key), i)
	return c
}
593442
func (p *TCompactProtocol) writeVarint32(n int32) (int, error) {
	i32buf := make([]byte, 5)
	idx := 0
	for {
		if (n & ^0x7F) == 0 {
			i32buf[idx] = byte(n)
			idx++
			// p.writeByteDirect(byte(n));
			break
			// return;
		} else {
			i32buf[idx] = byte((n & 0x7F) | 0x80)
			idx++
			// p.writeByteDirect(byte(((n & 0x7F) | 0x80)));
			u := uint32(n)
			n = int32(u >> 7)
		}
	}
	return p.trans.Write(i32buf[0:idx])
}
727729
func (ctx *Context) FormUint64(key string, defaults ...uint64) uint64 {
	return (*Forms)(ctx.req).MustUint64(key, defaults...)
}
585449
func (f *Queries) MustInt32(key string, defaults ...int32) int32 {
	if v, ok := f.Values()[key]; ok {
		i, err := strconv.ParseInt(v[0], 10, 32)
		if err == nil {
			return int32(i)
		}
	}
	if len(defaults) > 0 {
		return defaults[0]
	}
	return 0
}
980279
func (s *Service) FormRedirect(r *http.Request, host string) string {
	rq := r.URL.RawQuery
	if rq != "" {
		rq = fmt.Sprintf("?%s", rq)
	}
	return fmt.Sprintf("%s://%s%s%s", s.protocol(), host, r.URL.Path, rq)
}
462031
func (f *Forms) MustInt64(key string, defaults ...int64) int64 {
	v, err := strconv.ParseInt((*http.Request)(f).FormValue(key), 10, 64)
	if len(defaults) > 0 && err != nil {
		return defaults[0]
	}
	return v
}
67311
func Int32ToString(from int32) (string, error) {
	return strconv.FormatInt(int64(from), DefeultNumericBase), nil
}
172440
func (v *Validator) TypeInt(field string) *ValidationResult {
	if _, err := strconv.Atoi(v.data.Get(field)); err != nil {
		return v.addTypeError(field, "integer")
	} else {
		return validationOk
	}
}
1291699
func Int32P(val string) (*int32, error) {
	i, err := Int32(val)
	if err != nil {
		return nil, err
	}
	return proto.Int32(i), err
}