id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1 value |
|---|---|---|
c181800 | x := json.RawMessage(*this)
return (&x).MarshalJSON()
} | |
c181801 |
copy(b.h, final)
b.compress(b.h2)
output := make([]byte, 32)
outlen := len(output) >> 2
for i := 0; i < outlen; i++ {
j := 16 - outlen + i
binary.LittleEndian.PutUint32(output[4*i:], b.h[j])
}
return output
} | |
c181802 |
c.xl = iv[21]
c.xm = iv[22]
c.xn = iv[23]
c.xo = iv[24]
c.xp = iv[25]
c.xq = iv[26]
c.xr = iv[27]
c.xs = iv[28]
c.xt = iv[29]
c.xu = iv[30]
c.xv = iv[31]
return c
} | |
c181803 |
binary.LittleEndian.PutUint32(out[12:], c.x3)
binary.LittleEndian.PutUint32(out[16:], c.x4)
binary.LittleEndian.PutUint32(out[20:], c.x5)
binary.LittleEndian.PutUint32(out[24:], c.x6)
binary.LittleEndian.PutUint32(out[28:], c.x7)
return out
} | |
c181804 |
lyra2result := make([]byte, 32)
lyra2(lyra2result, resultcube, resultcube, 1, 4, 4)
var skeinresult [32]byte
skein.Sum256(&skeinresult, lyra2result, nil)
resultcube2 := cubehash256(skeinresult[:])
resultbmw := bmw256(resultcube2)
return resultbmw, nil
} | |
c181805 | copy(out[j*blockLenBytes:], tmp) //be care in case of len(out[i:])<len(tmp)
blake2bLyra(state)
}
} | |
c181806 | state[9]
ptrWord[10] = state[10]
ptrWord[11] = state[11]
//Goes to next block (column) that will receive the squeezed data
ptr -= blockLenInt64
//Applies the reduced-round transformation f to the sponge's state
reducedBlake2bLyra(state)
}
} | |
c181807 | state[10] ^= (ptrWordIn[10])
state[11] ^= (ptrWordIn[11])
//Applies the reduced-round transformation f to the sponge's state
reducedBlake2bLyra(state)
//M[row][C-1-col] = M[prev][col] XOR rand
ptrWordOut[0] = ptrWordIn[0] ^ state[0]
ptrWordOut[1] = ptrWordIn[1] ^ state[1]
ptrWordOut[2] = ptrWordIn[2] ^ state[2]
ptrWordOut[3] = ptrWordIn[3] ^ state[3]
ptrWordOut[4] = ptrWordIn[4] ^ state[4]
ptrWordOut[5] = ptrWordIn[5] ^ state[5]
ptrWordOut[6] = ptrWordIn[6] ^ state[6]
ptrWordOut[7] = ptrWordIn[7] ^ state[7]
ptrWordOut[8] = ptrWordIn[8] ^ state[8]
ptrWordOut[9] = ptrWordIn[9] ^ state[9]
ptrWordOut[10] = ptrWordIn[10] ^ state[10]
ptrWordOut[11] = ptrWordIn[11] ^ state[11]
//Input: next column (i.e., next block in sequence)
ptrIn += blockLenInt64
//Output: goes to previous column
ptrOut -= blockLenInt64
}
} | |
c181808 | &ReaderByteCodeLoader{NewFlags(), p, c}
} | |
c181809 |
fmt.Fprintf(os.Stderr, "AST:\n%s\n", ast)
}
bc, err := l.Compiler.Compile(ast)
if err != nil {
return nil, err
}
return bc, nil
} | |
c181810 | namespace, name)
uuid[6] = (uuid[6] & 0x0f) | 0x30
return uuid
} | |
c181811 | = st.CurrentOp().Arg()
st.Advance()
} | |
c181812 | vars.Get(key); ok {
st.sa = v
} else {
st.sa = nil
}
st.Advance()
} | |
c181813 | != rawStringType {
st.sa = rawString(interfaceToString(st.sa))
}
st.Advance()
} | |
c181814 | == rawStringType {
st.sa = string(interfaceToString(st.sa))
}
st.Advance()
} | |
c181815 | st.AppendOutputString(html.EscapeString(interfaceToString(arg)))
} else {
st.AppendOutputString(interfaceToString(arg))
}
st.Advance()
} | |
c181816 | nil {
st.Warnf("Use of nil to print\n")
} else {
st.AppendOutputString(interfaceToString(arg))
}
st.Advance()
} | |
c181817 | MaxIndex: array.Len() - 1,
PeekNext: nil,
PeekPrev: nil,
IsFirst: false,
IsLast: false,
}
return lv
} | |
c181818 | start (%d) >= end (%d)", start, end))
}
list := make([]interface{}, end-start+1)
for i := end; i >= start; i-- {
list[i-start] = st.StackPop()
}
st.sa = list
st.Advance()
} | |
c181819 | case reflect.Func:
txFunCall(st)
default:
st.Warnf("Unknown variable as function call: %s\n", st.sa)
st.sa = nil
st.Advance()
}
} | |
c181820 | f.flags |= MaskDumpAST
} else {
f.flags &= ^MaskDumpAST
}
} | |
c181821 | } else {
f.flags &= ^MaskDumpByteCode
}
} | |
c181822 | i+1 < bc.Len() && bc.Get(i+1).Type() == vm.TXOPPrintRaw {
bc.OpList[i] = vm.NewOp(vm.TXOPPrintRawConst, op.ArgString())
bc.OpList[i+1] = vm.NewOp(vm.TXOPNoop)
i++
}
}
}
return nil
} | |
c181823 | make(map[string]reflect.Value)}
} | |
c181824 | ok := fc.depot[key]
return f, ok
} | |
c181825 | fc.depot[key] = reflect.ValueOf(v)
} | |
c181826 | len(paths)),
}
for k, v := range paths {
abs, err := filepath.Abs(v)
if err != nil {
return nil, err
}
l.Paths[k] = abs
}
return l, nil
} | |
c181827 | is the first
// time we're checking for os.Stat()
fi, err := os.Stat(s.Path)
if err != nil {
return time.Time{}, err
}
// Save these for later...
s.LastStat = time.Now()
s.LastStatResult = fi
return s.LastStatResult.ModTime(), nil
} | |
c181828 | err := os.Open(s.Path)
if err != nil {
return nil, err
}
return fh, nil
} | |
c181829 | return nil, err
}
return ioutil.ReadAll(rdr)
} | |
c181830 | make(Vars),
warn: os.Stderr,
MaxLoopCount: 1000,
}
st.Pushmark()
st.PushFrame()
return st
} | |
c181831 |
f.SetMark(st.frames.Size())
return f
} | |
c181832 | i := st.framestack.Size(); i > f.Mark(); i-- {
st.framestack.Pop()
}
return f
} | |
c181833 | return nil
}
return x.(*frame.Frame)
} | |
c181834 | st.warn.Write([]byte(fmt.Sprintf(format, args...)))
} | |
c181835 | string) {
st.output.Write([]byte(o))
} | |
c181836 | st.markstack.Pop()
return x.(int)
} | |
c181837 | err != nil {
x = 0
}
return x.(int)
} | |
c181838 | return st.Loader.Load(key)
} | |
c181839 |
st.framestack.Reset()
st.Pushmark()
st.PushFrame()
} | |
c181840 |
return f.stack.Size() - 1
} | |
c181841 | "failed to get local variable at "+strconv.Itoa(i+f.mark))
}
return v, nil
} | |
c181842 | v interface{}) {
f.stack.Set(i, v)
} | |
c181843 | "",
OpList: nil,
Version: 1.0,
}
} | |
c181844 | = append(b.OpList, op)
} | |
c181845 | := NewOp(o, args...)
b.Append(x)
return x
} | |
c181846 | range b.OpList {
fmt.Fprintf(buf, "%03d. %s\n", k+1, v)
}
return buf.String()
} | |
c181847 | compiler),
NewReaderByteCodeLoader(parser, compiler),
fetcher,
[]Cache{MemoryCache{}, cache},
cacheLevel,
}
} | |
c181848 | nil {
source, err = l.Fetcher.FetchTemplate(key)
if err != nil {
return nil, errors.Wrap(err, "failed to fetch template")
}
}
rdr, err := source.Reader()
if err != nil {
return nil, errors.Wrap(err, "failed to get the reader")
}
bc, err = l.LoadReader(key, rdr)
if err != nil {
return nil, errors.Wrap(err, "failed to read byte code")
}
entity := &CacheEntity{bc, source}
for _, cache := range l.Caches {
cache.Set(key, entity)
}
return bc, nil
} | |
c181849 | := &FileCache{dir}
return f, nil
} | |
c181850 | path?
key = filepath.Clean(key)
key = strings.TrimPrefix(key, "/")
return filepath.Join(c.Dir, key)
} | |
c181851 | := gob.NewDecoder(file)
if err = dec.Decode(&entity); err != nil {
return nil, errors.Wrap(err, "failed to gob decode from cache file '"+path+"'")
}
return &entity, nil
} | |
c181852 | file, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0666)
if err != nil {
return errors.Wrap(err, "failed to open/create a cache file")
}
defer file.Close()
f := bufio.NewWriter(file)
defer f.Flush()
enc := gob.NewEncoder(f)
if err = enc.Encode(entity); err != nil {
return errors.Wrap(err, "failed to encode Entity via gob")
}
return nil
} | |
c181853 | errors.Wrap(os.Remove(c.GetCachePath(key)), "failed to remove file cache file")
} | |
c181854 |
return nil, errors.New("cache miss")
}
return bc, nil
} | |
c181855 |
c[key] = bc
return nil
} | |
c181856 | delete(c, key)
return nil
} | |
c181857 | l.SetTagStart("[%")
l.SetTagEnd("%]")
return l
} | |
c181858 | l.SetTagStart("[%")
l.SetTagEnd("%]")
return l
} | |
c181859 | UUID
copy(uuid[:], buf[:])
uuid.variantRFC4122()
return &uuid
} | |
c181860 | return p.ParseString(name, string(template))
} | |
c181861 | error) {
b := parser.NewBuilder()
lex := NewReaderLexer(rdr)
return b.Parse(name, lex)
} | |
c181862 | node.Node)
go func() {
defer close(c)
ast.Root.Visit(c)
}()
return c
} | |
c181863 | k++
fmt.Fprintf(buf, "%03d. %s\n", k, v)
}
return buf.String()
} | |
c181864 |
for k, v := range vm.functions {
st.vars[k] = v
}
}
if vars != nil {
for k, v := range vars {
st.vars[k] = v
}
}
st.Loader = vm.Loader
// This is the main loop
for op := st.CurrentOp(); op.Type() != TXOPEnd; op = st.CurrentOp() {
op.Call(st)
}
} | |
c181865 | case "TTerse":
tx.Parser = tterse.New()
case "Kolon", "Kolonish":
tx.Parser = kolonish.New()
default:
return errors.New("sytanx '" + syntax.(string) + "' is not available")
}
return nil
} | |
c181866 | return err
}
tmp, ok = args.Get("CacheLevel")
if !ok {
tmp = 1
}
cacheLevel := tmp.(int)
tx.Loader = loader.NewCachedByteCodeLoader(cache, loader.CacheStrategy(cacheLevel), fetcher, tx.Parser, tx.Compiler)
return nil
} | |
c181867 | dvm.Loader = tx.Loader
tx.VM = dvm
return nil
} | |
c181868 | ok := args[key]
return ret, ok
} | |
c181869 | if err != nil {
fmt.Printf("failed to parse: %s\n", err)
t = time.Now()
}
s.LastModifiedTime = t
} else {
s.LastModifiedTime = time.Now()
}
return s, nil
} | |
c181870 | &StringByteCodeLoader{NewFlags(), p, c}
} | |
c181871 | err := l.Compiler.Compile(ast)
if err != nil {
return nil, err
}
if l.ShouldDumpByteCode() {
fmt.Fprintf(os.Stderr, "ByteCode:\n%s\n", bc)
}
return bc, nil
} | |
c181872 | key = fmt.Sprintf("%s", k)
}
x, ok := v[key]
return x, ok
} | |
c181873 |
if len(args) > 0 {
arg = args[0]
}
return &op{
OpType: o,
OpHandler: h,
uArg: arg,
}
} | |
c181874 | case reflect.String:
binary.Write(buf, binary.LittleEndian, int64(6))
binary.Write(buf, binary.LittleEndian, int64(len(o.uArg.(string))))
for _, v := range []byte(o.uArg.(string)) {
binary.Write(buf, binary.LittleEndian, v)
}
default:
panic("Unknown type " + tArg.String())
}
}
v := o.comment
hasComment := v != ""
if hasComment {
binary.Write(buf, binary.LittleEndian, int8(1))
binary.Write(buf, binary.LittleEndian, v)
} else {
binary.Write(buf, binary.LittleEndian, int8(0))
}
return buf.Bytes(), nil
} | |
c181875 | }
b := make([]byte, l)
for i := int64(0); i < l; i++ {
if err := binary.Read(buf, binary.LittleEndian, &b[i]); err != nil {
return errors.Wrap(err, "failed to read bytes from buffer during UnmarshalBinary")
}
}
o.uArg = b
default:
panic(fmt.Sprintf("Unknown tArg: %d", tArg))
}
}
var hasComment int8
if err := binary.Read(buf, binary.LittleEndian, &hasComment); err != nil {
return errors.Wrap(err, "hasComment check failed during UnmarshalBinary")
}
if hasComment == 1 {
if err := binary.Read(buf, binary.LittleEndian, &o.comment); err != nil {
return errors.Wrap(err, "failed to read comment bytes during UnmarshalBinary")
}
}
return nil
} | |
c181876 | interfaceToNumeric(o.uArg)
return int(v.Int())
} | |
c181877 | ok {
return v
}
return interfaceToString(o.uArg)
} | |
c181878 | return ctx.ByteCode.AppendOp(o, args...)
} | |
c181879 | op
ctx.ByteCode.AppendOp(vm.TXOPEnd)
opt := &NaiveOptimizer{}
opt.Optimize(ctx.ByteCode)
ctx.ByteCode.Name = ast.Name
return ctx.ByteCode, nil
} | |
c181880 | uuid[6] = (uuid[6] & 0x0f) | 0x50
return uuid
} | |
c181881 | := LexSymbolSorter{
list: list,
}
sort.Sort(sorter)
return sorter.list
} | |
c181882 | s.list[i].Priority > s.list[j].Priority
} | |
c181883 | {
s.list[i], s.list[j] = s.list[j], s.list[i]
} | |
c181884 | c.Map[k] = LexSymbol{v.Name, v.Type, v.Priority}
}
return c
} | |
c181885 | = prio[0]
}
l.Map[name] = LexSymbol{name, typ, x}
l.SortedList = nil // reset
} | |
c181886 |
if l.SortedList != nil {
return l.SortedList
}
num := len(l.Map)
list := make(LexSymbolList, num)
i := 0
for _, v := range l.Map {
list[i] = v
i++
}
l.SortedList = list.Sort()
return l.SortedList
} | |
c181887 | == 0 {
return nil, errors.New("nothing on stack")
}
return (*s)[len(*s)-1], nil
} | |
c181888 | size)
copy(newl, *s)
*s = newl
} | |
c181889 | int) {
s.Resize(s.Size() + extendBy)
} | |
c181890 | // we have enough
return
}
s.Resize(calcNewSize(min))
} | |
c181891 | return nil, errors.New(strconv.Itoa(i) + " is out of range")
}
return (*s)[i], nil
} | |
c181892 |
}
if i >= s.BufferSize() {
s.Resize(calcNewSize(i))
}
for len(*s) < i + 1 {
*s = append(*s, nil)
}
(*s)[i] = v
return nil
} | |
c181893 | s.Resize(calcNewSize(cap(*s)))
}
*s = append(*s, v)
} | |
c181894 | if l == 0 {
return nil
}
v := (*s)[l-1]
*s = (*s)[:l-1]
return v
} | |
c181895 | "%03d: %q\n", k, v)
}
return buf.String()
} | |
c181896 |
continue
}
addrs, err := iface.Addrs()
if err != nil {
continue
}
for _, addr := range addrs {
if ipnet, ok := addr.(*net.IPNet); ok {
ips = append(ips, ipnet.IP)
}
}
}
return ips, nil
} | |
c181897 | ip.To4() == nil || !IsPrivate(ip) {
continue
}
privateIPs = append(privateIPs, ip)
}
return privateIPs, nil
} | |
c181898 | if ipnet.Contains(ip) {
return true
}
}
return false
} | |
c181899 |
if value, ok := getenv(f.Name); ok {
s = append(s, flagAsEnv(f.Name)+"="+value)
}
})
return s
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.