[ring]: fixed typo in marshal 32 bits

This commit is contained in:
Jean-Philippe Bossuat
2022-05-18 17:03:44 +02:00
parent 8e70872ec0
commit 950cd0ddda

View File

@@ -290,6 +290,7 @@ func (pol *Poly) WriteTo32(data []byte) (int, error) {
//The data is not big enough to write all the information
return 0, errors.New("data array is too small to write ring.Poly")
}
binary.BigEndian.PutUint32(data, uint32(N))
data[4] = uint8(Level)
if pol.IsNTT {
@@ -319,7 +320,7 @@ func WriteCoeffsTo32(pointer int, coeffs []uint64, data []byte) (int, error) {
// Assumes that each coefficient will be encoded on 4 bytes.
// It can take into account meta data if necessary.
func GetPolyDataLen32(N, Level int, WithMetadata bool) (cnt int) {
cnt += N * (Level + 1) << 4
cnt += N * (Level + 1) << 2
if WithMetadata {
cnt += 7