mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2025-12-22 04:32:49 +01:00
Commit forgotten code
This commit is contained in:
@@ -117,8 +117,7 @@ describe('calc.lshift', () => {
|
|||||||
expect(r.maxBitSize).toBe(64);
|
expect(r.maxBitSize).toBe(64);
|
||||||
expect(r.num()).toBe(-1);
|
expect(r.num()).toBe(-1);
|
||||||
|
|
||||||
const r2 = calc.or(Integer.unsigned(1123123, 32), new Integer(-1));
|
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')
|
||||||
expect(r2.maxBitSize).toBe(64);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ export default {
|
|||||||
_applyTwo(op1: Integer, op2: Integer, operation: (bin1:string, bin2:string) => string) : Integer {
|
_applyTwo(op1: Integer, op2: Integer, operation: (bin1:string, bin2:string) => string) : Integer {
|
||||||
|
|
||||||
if(op1.maxBitSize == op2.maxBitSize && op1.signed != op2.signed)
|
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);
|
const [num1, num2] = equalizeSize(op1, op2);
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ code { font-size: 1.2em; font-weight: bold; }
|
|||||||
.header-cmd { color: #c5c5c5 }
|
.header-cmd { color: #c5c5c5 }
|
||||||
|
|
||||||
.mono { font-family: monospace; font-size: 1.3em }
|
.mono { font-family: monospace; font-size: 1.3em }
|
||||||
|
|
||||||
.expressionInput {
|
.expressionInput {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
outline: none;
|
outline: none;
|
||||||
@@ -26,7 +27,7 @@ code { font-size: 1.2em; font-weight: bold; }
|
|||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
width: 600px;
|
width: 600px;
|
||||||
background: ragba(0, 0, 0, 0);
|
background: rgba(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden { display: none;}
|
.hidden { display: none;}
|
||||||
@@ -73,7 +74,6 @@ code { font-size: 1.2em; font-weight: bold; }
|
|||||||
.light .one { color: black; }
|
.light .one { color: black; }
|
||||||
.light .zero { color: #888; }
|
.light .zero { color: #888; }
|
||||||
.light .indicator { color: #ddd; }
|
.light .indicator { color: #ddd; }
|
||||||
.light .expressionInput { background: #ddd;}
|
|
||||||
.light .on { color: #121212; }
|
.light .on { color: #121212; }
|
||||||
.light .prefix { color: #888}
|
.light .prefix { color: #888}
|
||||||
.light .other { color: #bbb }
|
.light .other { color: #bbb }
|
||||||
@@ -90,7 +90,7 @@ code { font-size: 1.2em; font-weight: bold; }
|
|||||||
/* Dark */
|
/* Dark */
|
||||||
.dark { background: #121212; color: white;}
|
.dark { background: #121212; color: white;}
|
||||||
.dark .expression { color: white;}
|
.dark .expression { color: white;}
|
||||||
.dark .expressionInput { color: white; background: #555; }
|
.dark .expressionInput { color: white; }
|
||||||
.dark a, .dark a:visited { color: white; }
|
.dark a, .dark a:visited { color: white; }
|
||||||
.dark .indicator { color: #555; }
|
.dark .indicator { color: #555; }
|
||||||
.dark .on { color: white; }
|
.dark .on { color: white; }
|
||||||
@@ -112,7 +112,7 @@ code { font-size: 1.2em; font-weight: bold; }
|
|||||||
.midnight .header-cmd { color: #85a0ad }
|
.midnight .header-cmd { color: #85a0ad }
|
||||||
.midnight { background: #2c3e50; color: white }
|
.midnight { background: #2c3e50; color: white }
|
||||||
.midnight .expression { color: white;}
|
.midnight .expression { color: white;}
|
||||||
.midnight .expressionInput { background: #85a0ad; color: white;}
|
.midnight .expressionInput { color: white;}
|
||||||
.midnight a, .dark a:visited { color: white; }
|
.midnight a, .dark a:visited { color: white; }
|
||||||
.midnight .indicator { color: #85a0ad; }
|
.midnight .indicator { color: #85a0ad; }
|
||||||
.midnight .on { color: white; }
|
.midnight .on { color: white; }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
|
|
||||||
const APP_VERSION = 8;
|
const APP_VERSION = 9;
|
||||||
|
|
||||||
export type PersistedAppData = {
|
export type PersistedAppData = {
|
||||||
emphasizeBytes: boolean;
|
emphasizeBytes: boolean;
|
||||||
|
|||||||
@@ -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:
|
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>
|
</p>
|
||||||
<ul>
|
<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>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>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>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>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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div className="section">
|
<div className="section">
|
||||||
|
|||||||
@@ -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>
|
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>
|
<li>A slightly improved UI</li>
|
||||||
</ul>
|
</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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className='item'>
|
<div className='item'>
|
||||||
|
|||||||
Reference in New Issue
Block a user