* Get the decimal value * @this {!FieldModelDecimal} * @returns {!object} Result decimal value and its size
()
| 4111 | * @returns {!object} Result decimal value and its size |
| 4112 | */ |
| 4113 | get () { |
| 4114 | if ((this._buffer.offset + this.fbeOffset + this.fbeSize) > this._buffer.size) { |
| 4115 | return { value: new Big(0), size: 0 } |
| 4116 | } |
| 4117 | |
| 4118 | // Read decimal parts |
| 4119 | let low = this.readUInt32(this.fbeOffset) |
| 4120 | let mid = this.readUInt32(this.fbeOffset + 4) |
| 4121 | let high = this.readUInt32(this.fbeOffset + 8) |
| 4122 | let flags = this.readUInt32(this.fbeOffset + 12) |
| 4123 | |
| 4124 | // Calculate decimal value |
| 4125 | let negative = (flags & 0x80000000) !== 0 |
| 4126 | let scale = (flags & 0x7FFFFFFF) >> 16 |
| 4127 | let result = new Big(0) |
| 4128 | result = result.add(new Big(high).mul('18446744073709551616')) |
| 4129 | result = result.add(new Big(mid).mul('4294967296')) |
| 4130 | result = result.add(new Big(low)) |
| 4131 | result = result.div(Math.pow(10, scale)) |
| 4132 | if (negative) { |
| 4133 | result.s = -1 |
| 4134 | } |
| 4135 | |
| 4136 | return { value: result, size: this.fbeSize } |
| 4137 | } |
| 4138 | |
| 4139 | /** |
| 4140 | * Set the decimal value |
no test coverage detected