-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcell-size-2.bf
143 lines (143 loc) · 6.52 KB
/
cell-size-2.bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
[
This is another cell size detector. Unlike the very simple ones it
positivly confirms that an interpreter has a cell size of 8, 16 or
32bits. If it's cells size is actually 12, 17, 31bits or something
else you get a different response.
In addition unlike the other Cellsize programs the only optimisation
this needs to run successfully on a 32bit interpreter is run length
encoding.
Though, in fact, a JIT or assembler generator is likely to run in a
few seconds without any optimisation and a C compiler will probably
do the optimisation for you.
]
[-]>[-]++++++++++++[<+++++++>-]<.>+++++[<++++>-]<.+.++++++++++.[
-]++++++++[>++++<-]>.<+++++++++[>++++++++<-]>+.+++++.++++++.----
-----------.+++++++++++++.--.++.-------------.+++++++++++++++.--
-------------.+++++++++++++.[-]++++++++[<++++>-]<.>+++++++++[<++
++++++>-]<.-------.>++++++[<+++>-]<.[-]++++++++[>++++<-]>.[-]<
+>>+++++[-<<[->++++++++<]>[-<+>]>]<+<[[-]>[-]<
+[>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<-]>[<
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>-]<[>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<-]>[<
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>->+<]
+<[>-<
// Cell zero is 2147483648; Wipe carefully
>>[-<<
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
>>]<<[-]
+[>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<-]>[<
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>-]<[>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<-]>[<
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>->+<]
+<[
// Huge or abnormal cell size; cell is now 4294967296
>>[-<<
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
>>]<[-]<[-]
// This checks for ANY cell size under 21169 by using a
// double byte increment and checking the high 'byte'
+++++++[[->+++++++>+<<]>>[-<<+>>]<[[->++++++>+<<]>>[-<<+>>]<[>>
>+<+[>-]>[->>+<]<<
<<-]<-]<-] >>>>[-]>>>[[-]<<<<<<<+>>>>>>>]<<<<<<+<
[
// Small and weird cells
[-]>[-]+++++++++++++[<+++++++++>-]<--.------.------------.++++++
+++++..[-]++++++++[>++++<-]>.<+++++++++++++[>++++++<-]>.+.-.<+++
+++++[>--------<-]>-.<+++++++++[>++++++<-]>-.+++++++.+++++.-----
--------.<++++[>++++<-]>+.+++++++.[-]++++++++[<++++>-]<.>+++++++
++++[<++++++>-]<+.++.+++++++..+++++++.[-]++++++++++.[-]
]>[
// Huge cells
[-]>[-]++++++++++++[<+++++++++>-]<.-----------.>++++[<++++>-]<+.
-----------.--.[-]++++++++[>++++<-]>.<++++++++++[>++++++++<-]>-.
+++.[-]++++++++[<++++>-]<.>+++++++++++++[<++++++>-]<.+.-.>++++++
++[<-------->-]<-.>+++++++++[<++++++>-]<-.+++++++.+++++.--------
-----.>++++[<++++>-]<+.+++++++.[-]++++++++[>++++<-]>.<++++++++++
+[>++++++<-]>+.++.+++++++..+++++++.[-]++++++++++.[-]<
]<
#
>[-]<[-]] >[[-]>[-]<<
// 32bit cells
[-]>[-]++++++++++[<+++++>-]<+.-.>++++++++[<++++++>-]<.+++++++.++
+++++++++.[-]++++++++[>++++<-]>.<+++++++++++[>++++++<-]>+.++.+++
++++..+++++++.<++++++++++[>-------<-]>+.[-]++++++++++.[-]<
>[-]]<
[-]] >[-<
// 16 to 31 bit cells
// Check for exactly 16bit interpreters
[-]++>[-]>[-]+++++[-<<[->++++++++<]>[-<+>]>]<<
>+<[[-]>-<
// 17 to 31 bits
[-]>[-]+++++++[<+++++++>-]<.++++++.---------..+++++.--.>++++[<--
-->-]<-.>+++++++++++[<++++++>-]<.+++++++.+++++++++++.[-]++++++++
[>++++<-]>.<+++++++++++[>++++++<-]>+.++.+++++++..+++++++.[-]++++
++++++.[-]<
>[-]<[-]]>[-<
// Exactly 16 bits
[-]>[-]+++++++[<+++++++>-]<.+++++.>+++++++++++[<++++>-]<.+++++++
.+++++++++++.[-]++++++++[>++++<-]>.<+++++++++++[>++++++<-]>+.++.
+++++++..+++++++.<++++++++++[>-------<-]>+.[-]++++++++++.[-]<
>[-]]<
>[-]]<
>[-]<[-]]>[-<
// Less than 16bit cells
+>>[-]<[-]++++++++[>++++<-]>[<++++>-]<[
[-]>[-]++++++++[<++++++++>-]<[>++++<-]+>[<->[-]]<[
<->
// Exactly 8bit cells
[-]>[-]++++++++[<+++++++>-]<.[-]
[-]]
[-]]
<
[-
// 15 or fewer bits using a generic routine
>+[ [->++<]>[-<+>]<<+> ]<
>[-]>[-]>[-]>[-]>[-]>[-]+>[-]+>[-]+>[-]+<<<<<<<<<[->>+>+<<<]>>>[
-<<<+>>>]<[>[-]>[-]<<[>+>+<<-]>>[<<+>>-]+++++++++<[>>>[-]+<<[>+>
[-]<<-]>[<+>-]>[<<++++++++++>>-]<<-<-]+++++++++>[<->-]<[>+<-]<[>
+<-]<[>+<-]>>>[<<<+>>>-]>>>[-]<<<+++++++++<[>>>[-]+<<[>+>[-]<<-]
>[<+>-]>[<<++++++++++>>>+<-]<<-<-]>>>>[<<<<+>>>>-]<<<[-]<<+>]<[>
[-]<[>+<-]+++++++[<+++++++>-]<-.[-]>>[<<+>>-]<<-]<
[-]]
[-]>[-]++++++++++++++[<+++++++>-]<.+++++++.+++++++++++.[-]++++++
++[>++++<-]>.<+++++++++++[>++++++<-]>+.++.+++++++..+++++++.<++++
++++++[>-------<-]>+.[-]++++++++++.[-]<
>[-]]<