WIP: workaround

This commit is contained in:
Masaaki Goshima 2021-02-19 03:34:21 +09:00
parent 0272fd00f4
commit 413c811e37
2 changed files with 6 additions and 3 deletions

View File

@ -104,8 +104,6 @@ func encodeCompileHead(ctx *encodeCompileContext) (*opcode, error) {
typ = orgType typ = orgType
} else if isPtr && typ.Implements(marshalJSONType) { } else if isPtr && typ.Implements(marshalJSONType) {
typ = orgType typ = orgType
} else if isPtr && isIntOrUintType(typ) {
//typ = orgType
} }
code, err := encodeCompile(ctx.withType(typ)) code, err := encodeCompile(ctx.withType(typ))
if err != nil { if err != nil {

View File

@ -29,7 +29,12 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
case opInt: case opInt:
p := load(ctxptr, code.idx) p := load(ctxptr, code.idx)
u64 := ptrToUint64(p) u64 := ptrToUint64(p)
b = appendInt(b, u64&code.mask, (u64>>code.rshiftNum)&1 == 1) if (u64>>code.rshiftNum)&1 == 1 {
v := ^u64&code.mask + 1
b = appendInt(b, -v, true)
} else {
b = appendInt(b, u64&code.mask, (u64>>code.rshiftNum)&1 == 1)
}
b = encodeComma(b) b = encodeComma(b)
code = code.next code = code.next
case opUint: case opUint: