OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "type.h" | 6 #include "type.h" |
7 | 7 |
8 static int32 debug = 0; | 8 static int32 debug = 0; |
9 | 9 |
10 enum | 10 enum |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 { | 93 { |
94 Hchan *c; | 94 Hchan *c; |
95 int32 i; | 95 int32 i; |
96 | 96 |
97 if(elem->alg >= nelem(algarray)) { | 97 if(elem->alg >= nelem(algarray)) { |
98 printf("chan(alg=%d)\n", elem->alg); | 98 printf("chan(alg=%d)\n", elem->alg); |
99 throw("runtime.makechan: unsupported elem type"); | 99 throw("runtime.makechan: unsupported elem type"); |
100 } | 100 } |
101 | 101 |
102 c = mal(sizeof(*c)); | 102 c = mal(sizeof(*c)); |
103 » addfinalizer(c, destroychan, 0); | 103 » //addfinalizer(c, destroychan, 0); |
104 | 104 |
105 c->elemsize = elem->size; | 105 c->elemsize = elem->size; |
106 c->elemalg = &algarray[elem->alg]; | 106 c->elemalg = &algarray[elem->alg]; |
107 c->elemalign = elem->align; | 107 c->elemalign = elem->align; |
108 | 108 |
109 if(hint > 0) { | 109 if(hint > 0) { |
110 Link *d, *b, *e; | 110 Link *d, *b, *e; |
111 | 111 |
112 // make a circular q | 112 // make a circular q |
113 b = nil; | 113 b = nil; |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 static uint32 | 1085 static uint32 |
1086 fastrand2(void) | 1086 fastrand2(void) |
1087 { | 1087 { |
1088 static uint32 x = 0x49f6428aUL; | 1088 static uint32 x = 0x49f6428aUL; |
1089 | 1089 |
1090 x += x; | 1090 x += x; |
1091 if(x & 0x80000000L) | 1091 if(x & 0x80000000L) |
1092 x ^= 0xfafd871bUL; | 1092 x ^= 0xfafd871bUL; |
1093 return x; | 1093 return x; |
1094 } | 1094 } |
OLD | NEW |