201 {
202 if (value <= 240)
203 {
204 writer.WriteByte((byte)value);
205 return;
206 }
207 if (value <= 2287)
208 {
209 writer.WriteByte((byte)(((value - 240) >> 8) + 241));
210 writer.WriteByte((byte)((value - 240) & 0xFF));
211 return;
212 }
213 if (value <= 67823)
214 {
215 writer.WriteByte((byte)249);
216 writer.WriteByte((byte)((value - 2288) >> 8));
217 writer.WriteByte((byte)((value - 2288) & 0xFF));
218 return;
219 }
220 if (value <= 16777215)
221 {
222 writer.WriteByte((byte)250);
223 writer.WriteByte((byte)(value & 0xFF));
224 writer.WriteByte((byte)((value >> 8) & 0xFF));
225 writer.WriteByte((byte)((value >> 16) & 0xFF));
226 return;
227 }
228 if (value <= 4294967295)
229 {
230 writer.WriteByte((byte)251);
231 writer.WriteByte((byte)(value & 0xFF));
232 writer.WriteByte((byte)((value >> 8) & 0xFF));
233 writer.WriteByte((byte)((value >> 16) & 0xFF));
234 writer.WriteByte((byte)((value >> 24) & 0xFF));
235 return;
236 }
237 if (value <= 1099511627775)
238 {
239 writer.WriteByte((byte)252);
240 writer.WriteByte((byte)(value & 0xFF));
241 writer.WriteByte((byte)((value >> 8) & 0xFF));
242 writer.WriteByte((byte)((value >> 16) & 0xFF));
243 writer.WriteByte((byte)((value >> 24) & 0xFF));
244 writer.WriteByte((byte)((value >> 32) & 0xFF));
245 return;
246 }
247 if (value <= 281474976710655)
248 {
249 writer.WriteByte((byte)253);
250 writer.WriteByte((byte)(value & 0xFF));
251 writer.WriteByte((byte)((value >> 8) & 0xFF));
252 writer.WriteByte((byte)((value >> 16) & 0xFF));
253 writer.WriteByte((byte)((value >> 24) & 0xFF));
254 writer.WriteByte((byte)((value >> 32) & 0xFF));
255 writer.WriteByte((byte)((value >> 40) & 0xFF));
256 return;
257 }
258 if (value <= 72057594037927935)
259 {
260 writer.WriteByte((byte)254);
261 writer.WriteByte((byte)(value & 0xFF));
262 writer.WriteByte((byte)((value >> 8) & 0xFF));
263 writer.WriteByte((byte)((value >> 16) & 0xFF));
264 writer.WriteByte((byte)((value >> 24) & 0xFF));
265 writer.WriteByte((byte)((value >> 32) & 0xFF));
266 writer.WriteByte((byte)((value >> 40) & 0xFF));
267 writer.WriteByte((byte)((value >> 48) & 0xFF));
268 return;
269 }
270
271
272 {
273 writer.WriteByte((byte)255);
274 writer.WriteByte((byte)(value & 0xFF));
275 writer.WriteByte((byte)((value >> 8) & 0xFF));
276 writer.WriteByte((byte)((value >> 16) & 0xFF));
277 writer.WriteByte((byte)((value >> 24) & 0xFF));
278 writer.WriteByte((byte)((value >> 32) & 0xFF));
279 writer.WriteByte((byte)((value >> 40) & 0xFF));
280 writer.WriteByte((byte)((value >> 48) & 0xFF));
281 writer.WriteByte((byte)((value >> 56) & 0xFF));
282 }
283 }