Skip to content

Commit 155acbd

Browse files
authored
Allow for building 32 bit libraries for subparts (#14841)
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
1 parent c91f57b commit 155acbd

File tree

8 files changed

+68
-17
lines changed

8 files changed

+68
-17
lines changed

go/mysql/binlog/rbr_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func TestCellLengthAndData(t *testing.T) {
7878
styp: querypb.Type_UINT32,
7979
data: []byte{0x84, 0x83, 0x82, 0x81},
8080
out: sqltypes.MakeTrusted(querypb.Type_UINT32,
81-
[]byte(fmt.Sprintf("%v", 0x81828384))),
81+
[]byte(fmt.Sprintf("%v", uint32(0x81828384)))),
8282
}, {
8383
typ: TypeLong,
8484
styp: querypb.Type_INT32,

go/mysql/collations/colldata/mysqlucadata.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/mysql/datetime/interval.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@ func (itv *Interval) inRange() bool {
258258
if itv.day > maxDay {
259259
return false
260260
}
261-
if itv.hour > maxDay*24 {
261+
if itv.hour/24 > maxDay {
262262
return false
263263
}
264-
if itv.min > maxDay*24*60 {
264+
if itv.min/24/60 > maxDay {
265265
return false
266266
}
267-
if itv.sec > maxDay*24*60*60 {
267+
if itv.sec/24/60/60 > maxDay {
268268
return false
269269
}
270270
return true

go/mysql/decimal/scan.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,17 +311,12 @@ func pow(x big.Word, n int) (p big.Word) {
311311
}
312312

313313
func parseLargeDecimal(integral, fractional []byte) (*big.Int, error) {
314-
const (
315-
b1 = big.Word(10)
316-
bn = big.Word(1e19)
317-
n = 19
318-
)
319314
var (
320315
di = big.Word(0) // 0 <= di < b1**i < bn
321316
i = 0 // 0 <= i < n
322-
// 5 is the largest possible size for a MySQL decimal; anything
323-
// that doesn't fit in 5 words won't make it to this func
324-
z = make([]big.Word, 0, 5)
317+
// s is the largest possible size for a MySQL decimal; anything
318+
// that doesn't fit in s words won't make it to this func
319+
z = make([]big.Word, 0, s)
325320
)
326321

327322
parseChunk := func(partial []byte) error {

go/mysql/decimal/scan_32.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//go:build 386 || arm || mips || mipsle
2+
3+
/*
4+
Copyright 2023 The Vitess Authors.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package decimal
20+
21+
import "math/big"
22+
23+
const (
24+
b1 = big.Word(10)
25+
bn = big.Word(1e9)
26+
n = 9
27+
s = 10
28+
)

go/mysql/decimal/scan_64.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//go:build !386 && !arm && !mips && !mipsle
2+
3+
/*
4+
Copyright 2023 The Vitess Authors.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package decimal
20+
21+
import "math/big"
22+
23+
const (
24+
b1 = big.Word(10)
25+
bn = big.Word(1e19)
26+
n = 19
27+
s = 5
28+
)

go/mysql/icuregex/compiler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,7 +2698,7 @@ func (c *compiler) compileInterval(init opcode, loop opcode) {
26982698
// Goes at end of the block being looped over, so just append to the code so far.
26992699
c.appendOp(loop, topOfBlock)
27002700

2701-
if (c.intervalLow&0xff000000) != 0 || (c.intervalUpper > 0 && (c.intervalUpper&0xff000000) != 0) {
2701+
if c.intervalLow > 0x00ffffff || (c.intervalUpper > 0 && c.intervalUpper > 0x00ffffff) {
27022702
c.error(NumberTooBig)
27032703
}
27042704

@@ -3195,7 +3195,7 @@ func (c *compiler) maxMatchLength(start, end int) int32 {
31953195
}
31963196

31973197
blockLen := c.maxMatchLength(loc+4, loopEndLoc-1) // Recursive call.
3198-
updatedLen := int(currentLen) + int(blockLen)*maxLoopCount
3198+
updatedLen := int64(currentLen) + int64(blockLen)*int64(maxLoopCount)
31993199
if updatedLen >= math.MaxInt32 {
32003200
currentLen = math.MaxInt32
32013201
break

go/sqltypes/testing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ var RandomGenerators = map[Type]RandomGenerator{
229229
return NewFloat64(rand.ExpFloat64())
230230
},
231231
Decimal: func() Value {
232-
dec := fmt.Sprintf("%d.%d", rand.Intn(9999999999), rand.Intn(9999999999))
232+
dec := fmt.Sprintf("%d.%d", rand.Intn(999999999), rand.Intn(999999999))
233233
if rand.Int()&0x1 == 1 {
234234
dec = "-" + dec
235235
}

0 commit comments

Comments
 (0)