// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: axelar/utils/v1beta1/bitmap.proto

package utils

import (
	fmt "fmt"
	_ "github.com/gogo/protobuf/gogoproto"
	proto "github.com/gogo/protobuf/proto"
	io "io"
	math "math"
	math_bits "math/bits"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package

type Bitmap struct {
	TrueCountCache *CircularBuffer `protobuf:"bytes,2,opt,name=true_count_cache,json=trueCountCache,proto3" json:"true_count_cache,omitempty"`
}

func (m *Bitmap) Reset()         { *m = Bitmap{} }
func (m *Bitmap) String() string { return proto.CompactTextString(m) }
func (*Bitmap) ProtoMessage()    {}
func (*Bitmap) Descriptor() ([]byte, []int) {
	return fileDescriptor_1919f8dbb764fb71, []int{0}
}
func (m *Bitmap) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *Bitmap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_Bitmap.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *Bitmap) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Bitmap.Merge(m, src)
}
func (m *Bitmap) XXX_Size() int {
	return m.Size()
}
func (m *Bitmap) XXX_DiscardUnknown() {
	xxx_messageInfo_Bitmap.DiscardUnknown(m)
}

var xxx_messageInfo_Bitmap proto.InternalMessageInfo

type CircularBuffer struct {
	CumulativeValue []uint64 `protobuf:"varint,1,rep,packed,name=cumulative_value,json=cumulativeValue,proto3" json:"cumulative_value,omitempty"`
	Index           int32    `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
	MaxSize         int32    `protobuf:"varint,3,opt,name=max_size,json=maxSize,proto3" json:"max_size,omitempty"`
}

func (m *CircularBuffer) Reset()         { *m = CircularBuffer{} }
func (m *CircularBuffer) String() string { return proto.CompactTextString(m) }
func (*CircularBuffer) ProtoMessage()    {}
func (*CircularBuffer) Descriptor() ([]byte, []int) {
	return fileDescriptor_1919f8dbb764fb71, []int{1}
}
func (m *CircularBuffer) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *CircularBuffer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_CircularBuffer.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *CircularBuffer) XXX_Merge(src proto.Message) {
	xxx_messageInfo_CircularBuffer.Merge(m, src)
}
func (m *CircularBuffer) XXX_Size() int {
	return m.Size()
}
func (m *CircularBuffer) XXX_DiscardUnknown() {
	xxx_messageInfo_CircularBuffer.DiscardUnknown(m)
}

var xxx_messageInfo_CircularBuffer proto.InternalMessageInfo

func init() {
	proto.RegisterType((*Bitmap)(nil), "axelar.utils.v1beta1.Bitmap")
	proto.RegisterType((*CircularBuffer)(nil), "axelar.utils.v1beta1.CircularBuffer")
}

func init() { proto.RegisterFile("axelar/utils/v1beta1/bitmap.proto", fileDescriptor_1919f8dbb764fb71) }

var fileDescriptor_1919f8dbb764fb71 = []byte{
	// 288 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4a, 0xc3, 0x30,
	0x18, 0xc7, 0x5b, 0xe7, 0xa6, 0x44, 0x98, 0xa3, 0xec, 0x50, 0x3d, 0x84, 0x39, 0x3c, 0x4c, 0xc1,
	0x94, 0xe9, 0x1b, 0xb4, 0x17, 0x4f, 0x1e, 0x2a, 0x88, 0x78, 0x29,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, 0x76, 0xb6, 0x35, 0x76, 0x77, 0x35, 0x76, 0xbf, 0x6a, 0xec, 0x7e, 0x34, 0xd8, 0xd9,
	0x35, 0xd8, 0xf9, 0x6c, 0xb0, 0xf3, 0x72, 0x9d, 0x71, 0xbd, 0x34, 0x29, 0x61, 0x32, 0x0f, 0xba,
	0x5d, 0x0a, 0xd0, 0xef, 0x52, 0xbd, 0xed, 0xa7, 0x1b, 0x26, 0x15, 0x74, 0x95, 0xa6, 0x03, 0x5b,
	0xcc, 0xdd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xfe, 0x6f, 0x45, 0x69, 0x01, 0x00, 0x00,
}

func (m *Bitmap) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *Bitmap) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *Bitmap) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if m.TrueCountCache != nil {
		{
			size, err := m.TrueCountCache.MarshalToSizedBuffer(dAtA[:i])
			if err != nil {
				return 0, err
			}
			i -= size
			i = encodeVarintBitmap(dAtA, i, uint64(size))
		}
		i--
		dAtA[i] = 0x12
	}
	return len(dAtA) - i, nil
}

func (m *CircularBuffer) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *CircularBuffer) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *CircularBuffer) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if m.MaxSize != 0 {
		i = encodeVarintBitmap(dAtA, i, uint64(m.MaxSize))
		i--
		dAtA[i] = 0x18
	}
	if m.Index != 0 {
		i = encodeVarintBitmap(dAtA, i, uint64(m.Index))
		i--
		dAtA[i] = 0x10
	}
	if len(m.CumulativeValue) > 0 {
		dAtA3 := make([]byte, len(m.CumulativeValue)*10)
		var j2 int
		for _, num := range m.CumulativeValue {
			for num >= 1<<7 {
				dAtA3[j2] = uint8(uint64(num)&0x7f | 0x80)
				num >>= 7
				j2++
			}
			dAtA3[j2] = uint8(num)
			j2++
		}
		i -= j2
		copy(dAtA[i:], dAtA3[:j2])
		i = encodeVarintBitmap(dAtA, i, uint64(j2))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func encodeVarintBitmap(dAtA []byte, offset int, v uint64) int {
	offset -= sovBitmap(v)
	base := offset
	for v >= 1<<7 {
		dAtA[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	dAtA[offset] = uint8(v)
	return base
}
func (m *Bitmap) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	if m.TrueCountCache != nil {
		l = m.TrueCountCache.Size()
		n += 1 + l + sovBitmap(uint64(l))
	}
	return n
}

func (m *CircularBuffer) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	if len(m.CumulativeValue) > 0 {
		l = 0
		for _, e := range m.CumulativeValue {
			l += sovBitmap(uint64(e))
		}
		n += 1 + sovBitmap(uint64(l)) + l
	}
	if m.Index != 0 {
		n += 1 + sovBitmap(uint64(m.Index))
	}
	if m.MaxSize != 0 {
		n += 1 + sovBitmap(uint64(m.MaxSize))
	}
	return n
}

func sovBitmap(x uint64) (n int) {
	return (math_bits.Len64(x|1) + 6) / 7
}
func sozBitmap(x uint64) (n int) {
	return sovBitmap(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Bitmap) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowBitmap
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: Bitmap: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: Bitmap: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field TrueCountCache", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowBitmap
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthBitmap
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthBitmap
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.TrueCountCache == nil {
				m.TrueCountCache = &CircularBuffer{}
			}
			if err := m.TrueCountCache.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipBitmap(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if (skippy < 0) || (iNdEx+skippy) < 0 {
				return ErrInvalidLengthBitmap
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *CircularBuffer) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowBitmap
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: CircularBuffer: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: CircularBuffer: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType == 0 {
				var v uint64
				for shift := uint(0); ; shift += 7 {
					if shift >= 64 {
						return ErrIntOverflowBitmap
					}
					if iNdEx >= l {
						return io.ErrUnexpectedEOF
					}
					b := dAtA[iNdEx]
					iNdEx++
					v |= uint64(b&0x7F) << shift
					if b < 0x80 {
						break
					}
				}
				m.CumulativeValue = append(m.CumulativeValue, v)
			} else if wireType == 2 {
				var packedLen int
				for shift := uint(0); ; shift += 7 {
					if shift >= 64 {
						return ErrIntOverflowBitmap
					}
					if iNdEx >= l {
						return io.ErrUnexpectedEOF
					}
					b := dAtA[iNdEx]
					iNdEx++
					packedLen |= int(b&0x7F) << shift
					if b < 0x80 {
						break
					}
				}
				if packedLen < 0 {
					return ErrInvalidLengthBitmap
				}
				postIndex := iNdEx + packedLen
				if postIndex < 0 {
					return ErrInvalidLengthBitmap
				}
				if postIndex > l {
					return io.ErrUnexpectedEOF
				}
				var elementCount int
				var count int
				for _, integer := range dAtA[iNdEx:postIndex] {
					if integer < 128 {
						count++
					}
				}
				elementCount = count
				if elementCount != 0 && len(m.CumulativeValue) == 0 {
					m.CumulativeValue = make([]uint64, 0, elementCount)
				}
				for iNdEx < postIndex {
					var v uint64
					for shift := uint(0); ; shift += 7 {
						if shift >= 64 {
							return ErrIntOverflowBitmap
						}
						if iNdEx >= l {
							return io.ErrUnexpectedEOF
						}
						b := dAtA[iNdEx]
						iNdEx++
						v |= uint64(b&0x7F) << shift
						if b < 0x80 {
							break
						}
					}
					m.CumulativeValue = append(m.CumulativeValue, v)
				}
			} else {
				return fmt.Errorf("proto: wrong wireType = %d for field CumulativeValue", wireType)
			}
		case 2:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
			}
			m.Index = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowBitmap
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.Index |= int32(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 3:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field MaxSize", wireType)
			}
			m.MaxSize = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowBitmap
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.MaxSize |= int32(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		default:
			iNdEx = preIndex
			skippy, err := skipBitmap(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if (skippy < 0) || (iNdEx+skippy) < 0 {
				return ErrInvalidLengthBitmap
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func skipBitmap(dAtA []byte) (n int, err error) {
	l := len(dAtA)
	iNdEx := 0
	depth := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return 0, ErrIntOverflowBitmap
			}
			if iNdEx >= l {
				return 0, io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		wireType := int(wire & 0x7)
		switch wireType {
		case 0:
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowBitmap
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				iNdEx++
				if dAtA[iNdEx-1] < 0x80 {
					break
				}
			}
		case 1:
			iNdEx += 8
		case 2:
			var length int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowBitmap
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				length |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if length < 0 {
				return 0, ErrInvalidLengthBitmap
			}
			iNdEx += length
		case 3:
			depth++
		case 4:
			if depth == 0 {
				return 0, ErrUnexpectedEndOfGroupBitmap
			}
			depth--
		case 5:
			iNdEx += 4
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
		if iNdEx < 0 {
			return 0, ErrInvalidLengthBitmap
		}
		if depth == 0 {
			return iNdEx, nil
		}
	}
	return 0, io.ErrUnexpectedEOF
}

var (
	ErrInvalidLengthBitmap        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowBitmap          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupBitmap = fmt.Errorf("proto: unexpected end of group")
)
