[4e81ae]: src / int / fixed.h  Maximize  Restore  History

Download this file

611 lines (446 with data), 18.5 kB

  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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
/*
Copyright (C) 2001-2003 Motorola Inc
Copyright (C) 2001-2003 Laurent Mazet
Copyright (C) 2003 David Bateman
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
In addition to the terms of the GPL, you are permitted to link
this program with any Open Source program, as defined by the
Open Source Initiative (www.opensource.org)
*/
#if !defined (__int_fixed_h)
#define __int_fixed_h 1
#include <iosfwd>
#include <string>
#if defined(OCTAVE_FORGE)
# include <octave/config.h>
# include <octave/lo-utils.h>
# include <octave/lo-error.h>
# include <octave/error.h>
# if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
# pragma interface
# endif
# define fixed_error(code) { error ("%s", Fixed::message[code]); }
# define fixed_warning(code) { warning ("%s", Fixed::message[code]); }
#else
# include "config.h"
# define fixed_error(code) Fixed::_error (__FILE__, __LINE__, code)
# define fixed_warning(code) Fixed::_warning (__FILE__, __LINE__, code)
#endif
#include "fixedversion.h"
#if (SIZEOF_FIXED == 2)
typedef unsigned short int fp_uint;
typedef short int fp_int;
#elif (SIZEOF_FIXED == 4)
typedef unsigned long int fp_uint;
typedef long int fp_int;
#elif (SIZEOF_FIXED == 8)
typedef unsigned long long fp_uint;
typedef long long fp_int;
#else
typedef unsigned int fp_uint;
typedef int fp_int;
#if defined(SIZEOF_FIXED)
#undef SIZEOF_FIXED
#endif
#define SIZEOF_FIXED SIZEOF_INT
#endif
const unsigned int maxfixedsize = SIZEOF_FIXED * 8 - 2;
const unsigned int halffixedsize = SIZEOF_FIXED * 4;
// Mingw defines a macro ERROR that will cause some pain here.
#ifdef ERROR
#undef ERROR
#endif
class OCTAVE_FIXED_API FixedPoint
{
private:
// FixedPoint structure
fp_uint number;
unsigned int decsize;
unsigned int intsize;
fp_uint filter;
// Just for debugging
double value;
public:
// FixedPoint de-structurors
int sign () const {
if (number == 0)
return 0;
else
return ((number >> (decsize+intsize)) & 1 ? -1 : 1);
}
char signbit () const {
return ((number >> (decsize+intsize)));
}
friend int sign (FixedPoint &x);
friend char signbit (FixedPoint &x);
double fixedpoint() const;
friend double fixedpoint(const FixedPoint &x);
int getdecsize () const {
return (decsize);
}
friend int getdecsize (FixedPoint &x);
int getintsize () const {
return (intsize);
}
friend int getintsize (FixedPoint &x);
fp_uint getnumber () const {
return (number);
}
friend fp_uint getnumber (FixedPoint &x);
// FixedPoint constructor
FixedPoint () : number(0), decsize(0), intsize(0),
filter(0), value(0.0) { }
FixedPoint (unsigned int is, unsigned int ds, const fp_uint n = 0);
FixedPoint (unsigned int is, unsigned int ds,
const fp_uint i, const fp_uint d);
FixedPoint (unsigned int is, unsigned int ds, const FixedPoint &x);
FixedPoint (unsigned int is, unsigned int ds, const double x);
FixedPoint (const fp_int x);
FixedPoint (const double x);
#ifdef _MSC_VER
FixedPoint (const long double x) { *this = FixedPoint((const double)x); }
operator double () const { return fixedpoint(); }
#endif
FixedPoint (const FixedPoint &x) : number(x.number), decsize(x.decsize),
intsize(x.intsize), filter(x.filter),
value(x.value) { }
// Changing FixedPoint dynamic
FixedPoint chintsize (const int n) {
return (FixedPoint (n, decsize, *this));
}
FixedPoint chdecsize (const int n) {
return (FixedPoint (intsize, n, *this));
}
FixedPoint incintsize (const int n) {
return (FixedPoint (intsize+n, decsize, *this));
}
FixedPoint incdecsize (const int n) {
return (FixedPoint (intsize, decsize+n, *this));
}
FixedPoint incintsize () {
return (FixedPoint (intsize+1, decsize, *this));
}
FixedPoint incdecsize () {
return (FixedPoint (intsize, decsize+1, *this));
}
// FixedPoint intern operators
FixedPoint &operator = (const fp_int &x);
FixedPoint &operator = (const FixedPoint &x);
FixedPoint &operator += (const FixedPoint &x);
FixedPoint &operator -= (const FixedPoint &x);
FixedPoint &operator *= (const FixedPoint &x);
FixedPoint &operator /= (const FixedPoint &x);
FixedPoint &operator <<= (const int s);
FixedPoint &operator >>= (const int s);
// FixedPoint unary operators
FixedPoint &operator ++ ();
FixedPoint &operator -- ();
FixedPoint operator ++ (int);
FixedPoint operator -- (int);
friend FixedPoint operator + (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint operator - (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint operator ! (const FixedPoint &x);
// FixedPoint operators
friend FixedPoint operator + (const FixedPoint &x, const FixedPoint &y);
friend FixedPoint operator - (const FixedPoint &x, const FixedPoint &y);
friend FixedPoint operator * (const FixedPoint &x, const FixedPoint &y);
friend FixedPoint operator / (const FixedPoint &x, const FixedPoint &y);
friend FixedPoint operator << (const FixedPoint &x, const int s);
friend FixedPoint operator >> (const FixedPoint &x, const int s);
// FixedPoint comparators
friend OCTAVE_FIXED_API bool operator == (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API bool operator != (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API bool operator > (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API bool operator >= (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API bool operator < (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API bool operator <= (const FixedPoint &x, const FixedPoint &y);
// FixedPoint shifting functions
friend OCTAVE_FIXED_API FixedPoint rshift(const FixedPoint &x, int s);
friend OCTAVE_FIXED_API FixedPoint lshift(const FixedPoint &x, int s);
// FixedPoint mathematic functions
friend OCTAVE_FIXED_API FixedPoint real (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint imag (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint conj (const FixedPoint &x);
friend FixedPoint arg (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint abs (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint cos (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint cosh (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint sin (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint sinh (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint tan (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint tanh (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint sqrt (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint pow (const FixedPoint &w, const int y);
friend OCTAVE_FIXED_API FixedPoint pow (const FixedPoint &x, const double y);
friend OCTAVE_FIXED_API FixedPoint pow (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API FixedPoint exp (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint log (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint log10 (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint atan2 (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API FixedPoint round (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint rint (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint floor (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint ceil (const FixedPoint &x);
// FixedPoint I/O functions
friend OCTAVE_FIXED_API std::istream &operator >> (std::istream &is, FixedPoint &x);
friend OCTAVE_FIXED_API std::ostream &operator << (std::ostream &os, const FixedPoint &x);
friend OCTAVE_FIXED_API std::string getbitstring (const FixedPoint &x);
};
// Summary of the number of FixedPoint operations;
class OCTAVE_FIXED_API FixedPointOperation {
friend class FixedPoint;
friend OCTAVE_FIXED_API FixedPoint operator ! (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint operator - (const FixedPoint &x);
friend OCTAVE_FIXED_API bool operator == (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API bool operator != (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API bool operator > (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API bool operator >= (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API bool operator < (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API bool operator <= (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API FixedPoint real (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint imag (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint conj (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint abs (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint cos (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint cosh (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint sin (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint sinh (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint tan (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint tanh (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint sqrt(const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint pow (const FixedPoint &w, const int y);
friend OCTAVE_FIXED_API FixedPoint pow (const FixedPoint &x, const double y);
friend OCTAVE_FIXED_API FixedPoint pow (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API FixedPoint exp (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint log (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint log10 (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint atan2 (const FixedPoint &x, const FixedPoint &y);
friend OCTAVE_FIXED_API FixedPoint round (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint rint (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint floor (const FixedPoint &x);
friend OCTAVE_FIXED_API FixedPoint ceil (const FixedPoint &x);
private:
unsigned int nb_add;
unsigned int nb_sub;
unsigned int nb_mult;
unsigned int nb_div;
unsigned int nb_lshift;
unsigned int nb_rshift;
unsigned int nb_inc;
unsigned int nb_dec;
unsigned int nb_neg;
unsigned int nb_comp;
unsigned int nb_eq;
unsigned int nb_neq;
unsigned int nb_gt;
unsigned int nb_ge;
unsigned int nb_lt;
unsigned int nb_le;
unsigned int nb_cos;
unsigned int nb_cosh;
unsigned int nb_sin;
unsigned int nb_sinh;
unsigned int nb_tan;
unsigned int nb_tanh;
unsigned int nb_sqrt;
unsigned int nb_pow;
unsigned int nb_exp;
unsigned int nb_log;
unsigned int nb_log10;
unsigned int nb_atan2;
unsigned int nb_round;
unsigned int nb_rint;
unsigned int nb_floor;
unsigned int nb_ceil;
public:
FixedPointOperation();
void reset ();
friend OCTAVE_FIXED_API std::ostream &operator << (std::ostream &os,
const FixedPointOperation &x);
};
// Global constants
namespace Fixed {
const int MaxComment = 256;
// Some of these aren't used. Delete them??
typedef enum { ERROR = 0,
GET,
WRONGFIXSIZE,
BADMATH,
WARNING,
NAN_CONST,
INF_CONST,
LOSS_MSB_FP,
LOSS_MSB_INT,
LOSS_MSB_DEC,
LOSS_MSB_DB,
LOSS_MSB_ADD,
LOSS_MSB_SUB,
LOSS_MSB_MULT,
LOSS_MSB_LSHIFT,
LOSS_MSB_PRE_INC,
LOSS_MSB_PRE_DEC,
LOSS_MSB_POST_INC,
LOSS_MSB_POST_DEC } Code;
#if !defined(OCTAVE_FORGE)
void _error (char *file, int line, Code code = ERROR);
void _warning (char *file, int line, Code code = WARNING);
#endif
#if !defined (__int_fixed_cc)
extern OCTAVE_FIXED_API const char *FP_Version;
extern OCTAVE_FIXED_API const char *message[];
extern OCTAVE_FIXED_API bool FP_Debug;
extern OCTAVE_FIXED_API bool FP_Overflow;
extern OCTAVE_FIXED_API bool FP_CountOperations;
extern OCTAVE_FIXED_API FixedPointOperation FP_Operations;
#else
OCTAVE_FIXED_API const char *FP_Version = FIXEDVERSION;
OCTAVE_FIXED_API const char *message[19] =
{ "Error",
"Not enough data",
"Wrong fixed point size",
"Bad real math",
"Warning",
"Not a number (NaN) in FixedPoint constructor",
"Infinite value (Inf) in FixedPoint constructor",
"Losing most significant bits in FixedPoint constructor",
"Losing most significant bits in integer constructor (integer part)",
"Losing most significant bits in integer constructor (fractional part)",
"Losing most significant bits in double constructor",
"Losing most significant bits in addition operator",
"Losing most significant bits in subtraction operator",
"Losing most significant bits in multiplication operator",
"Losing most significant bits in left shift operator",
"Losing most significant bits in pre-increment operator",
"Losing most significant bits in pre-decrement operator",
"Losing most significant bits in post-increment operator",
"Losing most significant bits in post-decrement operator"
};
OCTAVE_FIXED_API bool FP_Debug = false;
OCTAVE_FIXED_API bool FP_Overflow = false;
OCTAVE_FIXED_API bool FP_CountOperations = false;
OCTAVE_FIXED_API FixedPointOperation FP_Operations;
#endif
};
// Declarations of fixed point functions
inline int sign (FixedPoint &x) {
return (x.sign());
}
inline char signbit (FixedPoint &x) {
return (x.signbit());
}
inline double fixedpoint(const FixedPoint &x) {
return (x.fixedpoint());
}
inline int getdecsize (FixedPoint &x) {
return (x.getdecsize());
}
inline int getintsize (FixedPoint &x) {
return (x.getintsize());
}
inline fp_uint getnumber (FixedPoint &x) {
return (x.getnumber());
}
inline FixedPoint operator + (const FixedPoint &x) {
return FixedPoint(x);
}
OCTAVE_FIXED_API FixedPoint operator - (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint operator ! (const FixedPoint &x);
inline FixedPoint operator + (const FixedPoint &x, const FixedPoint &y) {
FixedPoint x1(x);
return (x1 += y);
}
inline FixedPoint operator - (const FixedPoint &x, const FixedPoint &y) {
FixedPoint x1(x);
return (x1 -= y);
}
inline FixedPoint operator * (const FixedPoint &x, const FixedPoint &y) {
FixedPoint x1(x);
return (x1 *= y);
}
inline FixedPoint operator / (const FixedPoint &x, const FixedPoint &y) {
FixedPoint x1(x);
return (x1 /= y);
}
#ifdef _MSC_VER
#define FIXED_OP(R, OP, T1, C1, T2, C2) \
inline R operator OP (T1 x, T2 y) { \
return C1 (x) OP C2 (y); \
}
#define FIXED_OP2(R, OP, T) \
FIXED_OP(R, OP, const FixedPoint&, , T, FixedPoint) \
FIXED_OP(R, OP, T, FixedPoint, const FixedPoint&, )
#define FIXED_OPS(T) \
FIXED_OP2(FixedPoint, +, T) \
FIXED_OP2(FixedPoint, -, T) \
FIXED_OP2(FixedPoint, *, T) \
FIXED_OP2(FixedPoint, /, T) \
FIXED_OP2(bool, ==, T) \
FIXED_OP2(bool, !=, T) \
FIXED_OP2(bool, >, T) \
FIXED_OP2(bool, >=, T) \
FIXED_OP2(bool, <, T) \
FIXED_OP2(bool, <=, T)
FIXED_OPS(double)
FIXED_OPS(int)
#endif
inline FixedPoint operator << (const FixedPoint &x, const int s) {
FixedPoint n = x;
return (n <<= s);
}
inline FixedPoint operator >> (const FixedPoint &x, const int s) {
FixedPoint n = x;
return (n >>= s);
}
OCTAVE_FIXED_API bool operator == (const FixedPoint &x, const FixedPoint &y);
OCTAVE_FIXED_API bool operator != (const FixedPoint &x, const FixedPoint &y);
OCTAVE_FIXED_API bool operator > (const FixedPoint &x, const FixedPoint &y);
OCTAVE_FIXED_API bool operator >= (const FixedPoint &x, const FixedPoint &y);
OCTAVE_FIXED_API bool operator < (const FixedPoint &x, const FixedPoint &y);
OCTAVE_FIXED_API bool operator <= (const FixedPoint &x, const FixedPoint &y);
OCTAVE_FIXED_API FixedPoint rshift(const FixedPoint &x, int s = 1);
OCTAVE_FIXED_API FixedPoint lshift(const FixedPoint &x, int s = 1);
OCTAVE_FIXED_API FixedPoint real (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint imag (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint conj (const FixedPoint &x);
inline FixedPoint arg (const FixedPoint &x) {
return FixedPoint (x.getintsize (), x.getdecsize ());
}
OCTAVE_FIXED_API FixedPoint abs (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint cos (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint cosh (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint sin (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint sinh (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint tan (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint tanh (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint sqrt (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint pow (const FixedPoint &w, const int y);
OCTAVE_FIXED_API FixedPoint pow (const FixedPoint &x, const double y);
OCTAVE_FIXED_API FixedPoint pow (const FixedPoint &x, const FixedPoint &y);
OCTAVE_FIXED_API FixedPoint exp (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint log (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint log10 (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint atan2 (const FixedPoint &x, const FixedPoint &y);
OCTAVE_FIXED_API FixedPoint round (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint rint (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint floor (const FixedPoint &x);
OCTAVE_FIXED_API FixedPoint ceil (const FixedPoint &x);
OCTAVE_FIXED_API std::istream &operator >> (std::istream &is, FixedPoint &x);
OCTAVE_FIXED_API std::ostream &operator << (std::ostream &os, const FixedPoint &x);
OCTAVE_FIXED_API std::ostream &operator << (std::ostream &os, const FixedPointOperation &x);
OCTAVE_FIXED_API std::string getbitstring (const FixedPoint &x);
#endif
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/