Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for building 32 bit libraries for subparts #14841

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/mysql/binlog/rbr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestCellLengthAndData(t *testing.T) {
styp: querypb.Type_UINT32,
data: []byte{0x84, 0x83, 0x82, 0x81},
out: sqltypes.MakeTrusted(querypb.Type_UINT32,
[]byte(fmt.Sprintf("%v", 0x81828384))),
[]byte(fmt.Sprintf("%v", uint32(0x81828384)))),
}, {
typ: TypeLong,
styp: querypb.Type_INT32,
Expand Down
4 changes: 2 additions & 2 deletions go/mysql/collations/colldata/mysqlucadata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions go/mysql/datetime/interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,13 @@ func (itv *Interval) inRange() bool {
if itv.day > maxDay {
return false
}
if itv.hour > maxDay*24 {
if itv.hour/24 > maxDay {
return false
}
if itv.min > maxDay*24*60 {
if itv.min/24/60 > maxDay {
return false
}
if itv.sec > maxDay*24*60*60 {
if itv.sec/24/60/60 > maxDay {
return false
}
return true
Expand Down
11 changes: 3 additions & 8 deletions go/mysql/decimal/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,17 +311,12 @@ func pow(x big.Word, n int) (p big.Word) {
}

func parseLargeDecimal(integral, fractional []byte) (*big.Int, error) {
const (
b1 = big.Word(10)
bn = big.Word(1e19)
n = 19
)
var (
di = big.Word(0) // 0 <= di < b1**i < bn
i = 0 // 0 <= i < n
// 5 is the largest possible size for a MySQL decimal; anything
// that doesn't fit in 5 words won't make it to this func
z = make([]big.Word, 0, 5)
// s is the largest possible size for a MySQL decimal; anything
// that doesn't fit in s words won't make it to this func
z = make([]big.Word, 0, s)
)

parseChunk := func(partial []byte) error {
Expand Down
28 changes: 28 additions & 0 deletions go/mysql/decimal/scan_32.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//go:build 386 || arm || mips || mipsle

Comment on lines +1 to +2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License header are missing here and on go/mysql/decimal/scan_64.go

/*
Copyright 2023 The Vitess Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package decimal

import "math/big"

const (
b1 = big.Word(10)
bn = big.Word(1e9)
n = 9
s = 10
)
28 changes: 28 additions & 0 deletions go/mysql/decimal/scan_64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//go:build !386 && !arm && !mips && !mipsle

/*
Copyright 2023 The Vitess Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package decimal

import "math/big"

const (
b1 = big.Word(10)
bn = big.Word(1e19)
n = 19
s = 5
)
4 changes: 2 additions & 2 deletions go/mysql/icuregex/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2698,7 +2698,7 @@ func (c *compiler) compileInterval(init opcode, loop opcode) {
// Goes at end of the block being looped over, so just append to the code so far.
c.appendOp(loop, topOfBlock)

if (c.intervalLow&0xff000000) != 0 || (c.intervalUpper > 0 && (c.intervalUpper&0xff000000) != 0) {
if c.intervalLow > 0x00ffffff || (c.intervalUpper > 0 && c.intervalUpper > 0x00ffffff) {
c.error(NumberTooBig)
}

Expand Down Expand Up @@ -3195,7 +3195,7 @@ func (c *compiler) maxMatchLength(start, end int) int32 {
}

blockLen := c.maxMatchLength(loc+4, loopEndLoc-1) // Recursive call.
updatedLen := int(currentLen) + int(blockLen)*maxLoopCount
updatedLen := int64(currentLen) + int64(blockLen)*int64(maxLoopCount)
if updatedLen >= math.MaxInt32 {
currentLen = math.MaxInt32
break
Expand Down
2 changes: 1 addition & 1 deletion go/sqltypes/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ var RandomGenerators = map[Type]RandomGenerator{
return NewFloat64(rand.ExpFloat64())
},
Decimal: func() Value {
dec := fmt.Sprintf("%d.%d", rand.Intn(9999999999), rand.Intn(9999999999))
dec := fmt.Sprintf("%d.%d", rand.Intn(999999999), rand.Intn(999999999))
if rand.Int()&0x1 == 1 {
dec = "-" + dec
}
Expand Down
Loading