Example #1
0
File: value.cs Project: zjmit/go2cs
                            private static long hash(this structure x, types.Type t)
                            {
                                ptr <types.Struct> tStruct = t.Underlying()._ <ptr <types.Struct> >();
                                long h = 0L;

                                for (long i = 0L;
                                     var n = tStruct.NumFields(); i < n; i++)
                                {
                                    {
                                        var f = tStruct.Field(i);

                                        if (!f.Anonymous())
                                        {
                                            h += hash(f.Type(), x[i]);
                                        }
                                    }
                                }

                                return(h);
                            }
Example #2
0
File: value.cs Project: zjmit/go2cs
                            private static bool eq(this structure x, types.Type t, object _y)
                            {
                                structure          y       = _y._ <structure>();
                                ptr <types.Struct> tStruct = t.Underlying()._ <ptr <types.Struct> >();

                                for (long i = 0L;
                                     var n = tStruct.NumFields(); i < n; i++)
                                {
                                    {
                                        var f = tStruct.Field(i);

                                        if (!f.Anonymous())
                                        {
                                            if (!equals(f.Type(), x[i], y[i]))
                                            {
                                                return(false);
                                            }
                                        }
                                    }
                                }

                                return(true);
                            }