1// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2// Use of this source code is governed by a MIT license found in the LICENSE file.
3
4// +build notfastpath
5
6package codec
7
8import "reflect"
9
10const fastpathEnabled = false
11
12// The generated fast-path code is very large, and adds a few seconds to the build time.
13// This causes test execution, execution of small tools which use codec, etc
14// to take a long time.
15//
16// To mitigate, we now support the notfastpath tag.
17// This tag disables fastpath during build, allowing for faster build, test execution,
18// short-program runs, etc.
19
20func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool      { return false }
21func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool      { return false }
22func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false }
23func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool   { return false }
24func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool           { return false }
25
26type fastpathT struct{}
27type fastpathE struct {
28	rtid  uintptr
29	rt    reflect.Type
30	encfn func(*Encoder, *codecFnInfo, reflect.Value)
31	decfn func(*Decoder, *codecFnInfo, reflect.Value)
32}
33type fastpathA [0]fastpathE
34
35func (x fastpathA) index(rtid uintptr) int { return -1 }
36
37var fastpathAV fastpathA
38var fastpathTV fastpathT
39
40// ----
41type TestMammoth2Wrapper struct{} // to allow testMammoth work in notfastpath mode
42