Commit forgotten code

This commit is contained in:
BorysLevytskyi
2023-05-10 13:03:17 +02:00
parent 23748831ba
commit 8371e3c086
6 changed files with 12 additions and 11 deletions

View File

@@ -117,8 +117,7 @@ describe('calc.lshift', () => {
expect(r.maxBitSize).toBe(64);
expect(r.num()).toBe(-1);
const r2 = calc.or(Integer.unsigned(1123123, 32), new Integer(-1));
expect(r2.maxBitSize).toBe(64);
expect(() => calc.or(Integer.unsigned(1123123, 32), new Integer(-1))).toThrowError('This operation cannot be applied to signed and unsigned operands of the same size')
});
});

View File

@@ -123,7 +123,7 @@ export default {
_applyTwo(op1: Integer, op2: Integer, operation: (bin1:string, bin2:string) => string) : Integer {
if(op1.maxBitSize == op2.maxBitSize && op1.signed != op2.signed)
throw new Error("Operator `" + operation + "` cannot be applied to signed and unsigned operands of the same size");
throw new Error("This operation cannot be applied to signed and unsigned operands of the same size");
const [num1, num2] = equalizeSize(op1, op2);

View File

@@ -17,6 +17,7 @@ code { font-size: 1.2em; font-weight: bold; }
.header-cmd { color: #c5c5c5 }
.mono { font-family: monospace; font-size: 1.3em }
.expressionInput {
padding: 3px;
outline: none;
@@ -26,7 +27,7 @@ code { font-size: 1.2em; font-weight: bold; }
padding-left: 15px;
padding-bottom: 5px;
width: 600px;
background: ragba(0, 0, 0, 0);
background: rgba(0, 0, 0, 0);
}
.hidden { display: none;}
@@ -73,7 +74,6 @@ code { font-size: 1.2em; font-weight: bold; }
.light .one { color: black; }
.light .zero { color: #888; }
.light .indicator { color: #ddd; }
.light .expressionInput { background: #ddd;}
.light .on { color: #121212; }
.light .prefix { color: #888}
.light .other { color: #bbb }
@@ -90,7 +90,7 @@ code { font-size: 1.2em; font-weight: bold; }
/* Dark */
.dark { background: #121212; color: white;}
.dark .expression { color: white;}
.dark .expressionInput { color: white; background: #555; }
.dark .expressionInput { color: white; }
.dark a, .dark a:visited { color: white; }
.dark .indicator { color: #555; }
.dark .on { color: white; }
@@ -112,7 +112,7 @@ code { font-size: 1.2em; font-weight: bold; }
.midnight .header-cmd { color: #85a0ad }
.midnight { background: #2c3e50; color: white }
.midnight .expression { color: white;}
.midnight .expressionInput { background: #85a0ad; color: white;}
.midnight .expressionInput { color: white;}
.midnight a, .dark a:visited { color: white; }
.midnight .indicator { color: #85a0ad; }
.midnight .on { color: white; }

View File

@@ -1,6 +1,6 @@
import log from 'loglevel';
const APP_VERSION = 8;
const APP_VERSION = 9;
export type PersistedAppData = {
emphasizeBytes: boolean;

View File

@@ -63,10 +63,10 @@ function HelpResultView() {
BitiwseCmd no longer uses the browser's JavaScript engine for the execution of bitwise operations. It has its own calculator implementation which brings supports bitwise operations on the following <i>signed</i> and <i>unsigned</i> data types:
</p>
<ul>
<li><code>8-bit integer</code> - numbers entered with <code>b</code> or <code>ub</code> suffixes for signed and unsigned versions respectively (e.g. <CommandLink text='10b 10ub' />).</li>
<li><code>64-bit integer</code> - numbers entered with <code>s</code> or <code>us</code> suffixes for signed and unsigned versions respectively (e.g. <CommandLink text='10s 10us' />).</li>
<li><code>8-bit integer</code> - a.k.a Byte. Numbers entered with <code>b</code> or <code>ub</code> suffixes for signed and unsigned versions respectively (e.g. <CommandLink text='10b 10ub' />).</li>
<li><code>16-bit integer</code> - a.k.a Short. Numbers entered with <code>s</code> or <code>us</code> suffixes for signed and unsigned versions respectively (e.g. <CommandLink text='10s 10us' />).</li>
<li><code>32-bit integer</code> - numbers entered without suffixes that fall in range of {INT32_MIN_VALUE} and {INT32_MAX_VALUE}. Use <code>u</code> suffix to denote an unsigned version of 32-bit integer. This is a default number type.</li>
<li><code>64-bit integer</code> - numbers entered without suffixes and exceed the 32-bit range or entered with and and <code>ul</code> suffixes for signed and unsigned versions respectively (e.g. <CommandLink text='10l 10ul' />).</li>
<li><code>64-bit integer</code> - a.k.a Long. Numbers entered without suffixes and exceed the 32-bit range or entered with and and <code>ul</code> suffixes for signed and unsigned versions respectively (e.g. <CommandLink text='10l 10ul' />).</li>
</ul>
</div>
<div className="section">

View File

@@ -19,6 +19,8 @@ function WhatsnewResultView() {
This includes shifting an integer by the number of bytes equal to its size (spoiler: you get the same number, this is undefined behavior in C. Don't believe me? Check this <a href="https://codeyarns.com/tech/2004-12-20-c-shift-operator-mayhem.html#gsc.tab=0">link</a>).</li>
<li>A slightly improved UI</li>
</ul>
<p>I'm sure there will be some bugs following such a big update. I will do my best to fix them as they are found.</p>
<p>Many thanks to all people that submitted issues on GitHub. Your feedback is greatly appreciated. </p>
</p>
</div>
<div className='item'>