mirror of
https://github.com/badvision/jace.git
synced 2025-02-17 08:30:53 +00:00
Code cleanup (removal of redundant casts)
This commit is contained in:
parent
063ad95325
commit
df7209930c
@ -1,7 +1,7 @@
|
||||
package jace.assembly;
|
||||
|
||||
import jace.ide.Program;
|
||||
import jace.ide.CompileResult;
|
||||
import jace.ide.Program;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
|
@ -5026,7 +5026,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
r2 = readPages[(r4+8)>>>12][((r4+8)>>>2)&0x3ff];
|
||||
r8 = readPages[(r3+8)>>>12][((r3+8)>>>2)&0x3ff];
|
||||
writePages[(r3+16)>>>12][((r3+16)>>>2)&0x3ff] = r0;
|
||||
{ long hilo = (long)(r8) * ((long)r2); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r8) * r2; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r2 = lo;
|
||||
writePages[(r3+8)>>>12][((r3+8)>>>2)&0x3ff] = r2;
|
||||
r2 = r0 + 2;
|
||||
@ -5067,7 +5067,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
}
|
||||
case 0x139bc:
|
||||
r10 = r2 & 1;
|
||||
{ long hilo = (long)(r9) * ((long)r8); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r9) * r8; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
if(r10 == r0) {
|
||||
/* Next insn is delay slot */
|
||||
pc=0x139d0;
|
||||
@ -5076,7 +5076,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
r9 = lo;
|
||||
case 0x139d0:
|
||||
r2 = r2 >> 1;
|
||||
{ long hilo = (long)(r8) * ((long)r8); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r8) * r8; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r8 = lo;
|
||||
if(r2 != r0) {
|
||||
/* Next insn is delay slot */
|
||||
@ -44498,7 +44498,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
for(;;) {
|
||||
switch(pc) {
|
||||
case 0x3c200:
|
||||
{ long hilo = (long)(r7) * ((long)r6); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r7) * r6; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r29 = r29 + -64;
|
||||
writePages[(r29+44)>>>12][((r29+44)>>>2)&0x3ff] = r21;
|
||||
writePages[(r29+52)>>>12][((r29+52)>>>2)&0x3ff] = r23;
|
||||
@ -44913,7 +44913,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
case 0x3c870:
|
||||
r20 = lo;
|
||||
r20 = r20 + -1;
|
||||
{ long hilo = (long)(r20) * ((long)r16); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r20) * r16; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r20 = lo;
|
||||
r16 = r20 < r16 ? 1 : 0;
|
||||
if(r16 != r0) {
|
||||
@ -46257,7 +46257,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
for(;;) {
|
||||
switch(pc) {
|
||||
case 0x3da00:
|
||||
{ long hilo = (long)(r7) * ((long)r6); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r7) * r6; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r29 = r29 + -64;
|
||||
r2 = r29 + 28;
|
||||
writePages[(r29+48)>>>12][((r29+48)>>>2)&0x3ff] = r18;
|
||||
@ -50523,7 +50523,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
continue;
|
||||
}
|
||||
case 0x432ec:
|
||||
{ long hilo = (long)(r2) * ((long)r24); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r2) * r24; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r12 = r0 + 1;
|
||||
r2 = lo;
|
||||
r2 = r8 + r2;
|
||||
@ -67553,13 +67553,13 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
r11 = readPages[(r6+-4)>>>12][((r6+-4)>>>2)&0x3ff];
|
||||
r8 = readPages[(r3+0)>>>12][((r3+0)>>>2)&0x3ff];
|
||||
r10 = r11 & 65535;
|
||||
{ long hilo = (long)(r22) * ((long)r10); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r22) * r10; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r11 = r11 >>> 16;
|
||||
r3 = r3 + 4;
|
||||
r10 = lo;
|
||||
r10 = r4 + r10;
|
||||
r4 = r10 >>> 16;
|
||||
{ long hilo = (long)(r22) * ((long)r11); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r22) * r11; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r7 = r10 & 65535;
|
||||
r7 = r2 - r7;
|
||||
r11 = lo;
|
||||
@ -72043,13 +72043,13 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
r11 = readPages[(r3+0)>>>12][((r3+0)>>>2)&0x3ff];
|
||||
r8 = r8 + 1;
|
||||
r9 = r11 & 65535;
|
||||
{ long hilo = (long)(r9) * ((long)r6); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r9) * r6; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r11 = r11 >>> 16;
|
||||
r3 = r3 + 4;
|
||||
r9 = lo;
|
||||
r9 = r9 + r7;
|
||||
r7 = r9 >>> 16;
|
||||
{ long hilo = (long)(r11) * ((long)r6); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r11) * r6; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r9 = r9 & 65535;
|
||||
r11 = lo;
|
||||
r10 = r7 + r11;
|
||||
@ -72607,7 +72607,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
r6 = readPages[(r3+0)>>>12][((r3+0)>>>2)&0x3ff];
|
||||
r7 = readPages[(r4+0)>>>12][((r4+0)>>>2)&0x3ff];
|
||||
r5 = r6 & 65535;
|
||||
{ long hilo = (long)(r5) * ((long)r8); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r5) * r8; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r6 = r6 >>> 16;
|
||||
r10 = r7 & 65535;
|
||||
r7 = r7 >>> 16;
|
||||
@ -72615,7 +72615,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
r5 = lo;
|
||||
r5 = r5 + r10;
|
||||
r5 = r5 + r9;
|
||||
{ long hilo = (long)(r6) * ((long)r8); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r6) * r8; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r9 = r5 >>> 16;
|
||||
r5 = r5 & 65535;
|
||||
r6 = lo;
|
||||
@ -72657,7 +72657,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
tmp = (tmp>>>(((~addr)&2)<<3)) & 0xffff;
|
||||
r6 = tmp;
|
||||
r7 = r7 >>> 16;
|
||||
{ long hilo = (long)(r6) * ((long)r9); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r6) * r9; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r4 = r4 & 65535;
|
||||
r3 = r3 + 4;
|
||||
r8 = r5 + 4;
|
||||
@ -72672,7 +72672,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
tmp = (tmp>>>(((~addr)&2)<<3)) & 0xffff;
|
||||
r4 = tmp;
|
||||
r7 = readPages[(r5+4)>>>12][((r5+4)>>>2)&0x3ff];
|
||||
{ long hilo = (long)(r4) * ((long)r9); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r4) * r9; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r10 = r7 & 65535;
|
||||
r6 = r6 >>> 16;
|
||||
r4 = lo;
|
||||
@ -74973,7 +74973,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
continue;
|
||||
}
|
||||
case 0x5f8c0:
|
||||
{ long hilo = (long)(r2) * ((long)r15); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r2) * r15; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r10 = r0 + 1;
|
||||
r2 = lo;
|
||||
r2 = r8 + r2;
|
||||
@ -82614,7 +82614,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
for(;;) {
|
||||
switch(pc) {
|
||||
case 0x65600:
|
||||
{ long hilo = (long)(r5) * ((long)r6); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r5) * r6; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r29 = r29 + -48;
|
||||
writePages[(r29+44)>>>12][((r29+44)>>>2)&0x3ff] = r31;
|
||||
writePages[(r29+40)>>>12][((r29+40)>>>2)&0x3ff] = r20;
|
||||
@ -86669,7 +86669,7 @@ public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime {
|
||||
for(;;) {
|
||||
switch(pc) {
|
||||
case 0x69000:
|
||||
{ long hilo = (long)(r7) * ((long)r6); hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
{ long hilo = (r7) * r6; hi = (int) (hilo >>> 32); lo = (int) hilo; }
|
||||
r29 = r29 + -56;
|
||||
writePages[(r29+40)>>>12][((r29+40)>>>2)&0x3ff] = r21;
|
||||
writePages[(r29+48)>>>12][((r29+48)>>>2)&0x3ff] = r23;
|
||||
|
@ -223,9 +223,9 @@ public class PrinceOfPersiaCheats extends Cheats {
|
||||
// that are on the left edge of the screen!
|
||||
int yCoor = ((int) (y * 192) % 63);
|
||||
if (yCoor >= 47) {
|
||||
double yOffset = 1.0 - (((double) yCoor - 47.0) / 16.0);
|
||||
double yOffset = 1.0 - ((yCoor - 47.0) / 16.0);
|
||||
int xCoor = ((int) (x * 280) % 28);
|
||||
double xOffset = ((double) xCoor) / 28.0;
|
||||
double xOffset = xCoor / 28.0;
|
||||
if (xOffset <= yOffset) {
|
||||
col--;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class ClassSelection extends DynamicSelection<Class> {
|
||||
@Override
|
||||
public LinkedHashMap<Class, String> getSelections() {
|
||||
LinkedHashMap<Class, String> selections = new LinkedHashMap<>();
|
||||
Set<? extends Class> allClasses = (Set<? extends Class>) Utility.findAllSubclasses(template);
|
||||
Set<? extends Class> allClasses = Utility.findAllSubclasses(template);
|
||||
if (!allClasses.contains(null)) {
|
||||
allClasses.add(null);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public abstract class KeyHandler {
|
||||
if (testCode != null) {
|
||||
key = testCode;
|
||||
} else {
|
||||
init((KeyCodeCombination) KeyCodeCombination.valueOf(comboText));
|
||||
init(KeyCodeCombination.valueOf(comboText));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ package jace.core;
|
||||
|
||||
import jace.config.ConfigurableField;
|
||||
import jace.config.DynamicSelection;
|
||||
import jace.config.Reconfigurable;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -185,7 +186,7 @@ public class SoundMixer extends Device {
|
||||
lineAvailable = false;
|
||||
throw new LineUnavailableException("Line is not an output line!");
|
||||
}
|
||||
final SourceDataLine sdl = (SourceDataLine) l;
|
||||
final SourceDataLine sdl = l;
|
||||
sdl.open();
|
||||
return sdl;
|
||||
}
|
||||
@ -216,7 +217,7 @@ public class SoundMixer extends Device {
|
||||
}
|
||||
return o;
|
||||
}).filter((o) -> (o instanceof Card)).forEach((o) -> {
|
||||
((Card) o).reconfigure();
|
||||
((Reconfigurable) o).reconfigure();
|
||||
});
|
||||
if (theMixer != null) {
|
||||
for (Line l : theMixer.getSourceLines()) {
|
||||
|
@ -115,7 +115,7 @@ public abstract class TimedDevice extends Device {
|
||||
|
||||
public final void setSpeed(long cyclesPerSecond) {
|
||||
cyclesPerInterval = cyclesPerSecond / 100L;
|
||||
nanosPerInterval = (long) ((double) cyclesPerInterval * NANOS_PER_SECOND / (double) cyclesPerSecond);
|
||||
nanosPerInterval = (long) (cyclesPerInterval * NANOS_PER_SECOND / cyclesPerSecond);
|
||||
// System.out.println("Will pause " + nanosPerInterval + " nanos every " + cyclesPerInterval + " cycles");
|
||||
cycleTimer = 0;
|
||||
resetSyncTimer();
|
||||
|
@ -238,7 +238,7 @@ public class CardMockingboard extends Card implements Runnable {
|
||||
/* The AY-3-8910 has 16 levels, in a logarithmic scale (3dB per step) */
|
||||
/* The YM2149 still has 16 levels for the tone generators, but 32 for */
|
||||
/* the envelope generator (1.5dB per step). */
|
||||
double out = ((double) MAX_AMPLITUDE * (double) volume) / 100.0;
|
||||
double out = (MAX_AMPLITUDE * volume) / 100.0;
|
||||
// Reduce max amplitude to reflect post-mixer values so we don't have to scale volume when mixing channels
|
||||
out = out * 2.0 / 3.0 / numChips;
|
||||
double delta = 1.15;
|
||||
|
@ -94,7 +94,7 @@ public class LargeDisk implements IDisk {
|
||||
memory.write(MLI_UNITNUMBER, slot16, false, false);
|
||||
// Write location to block read routine to zero page
|
||||
memory.writeWord(0x048, 0x0c000 + CardMassStorage.DEVICE_DRIVER_OFFSET + (slot * 0x0100), false, false);
|
||||
((MOS65C02) computer.getCpu()).setProgramCounter(0x0800);
|
||||
computer.getCpu().setProgramCounter(0x0800);
|
||||
computer.resume();
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ public class AY8910_old {
|
||||
/* number. */
|
||||
double clk = clock;
|
||||
double smprate = SampleRate;
|
||||
UpdateStep = (int) (((double)STEP * smprate * 8.0 + clk/2.0) / clk);
|
||||
UpdateStep = (int) ((STEP * smprate * 8.0 + clk/2.0) / clk);
|
||||
}
|
||||
|
||||
public void setReg(Reg r, int value) {
|
||||
|
@ -52,12 +52,12 @@ public class TimedGenerator {
|
||||
public void setRate(int clock, int sample_rate) {
|
||||
sampleRate = sample_rate;
|
||||
this.clock = clock;
|
||||
cyclesPerSample = ((double) clock) / ((double) sampleRate);
|
||||
cyclesPerSample = clock / sampleRate;
|
||||
}
|
||||
|
||||
public void setPeriod(int _period) {
|
||||
period = _period > 0 ? _period : 1;
|
||||
clocksPerPeriod = (int) (period * stepsPerCycle());
|
||||
clocksPerPeriod = (period * stepsPerCycle());
|
||||
// set counter back... necessary?
|
||||
// while (clocksPerPeriod > period) {
|
||||
// counter -= clocksPerPeriod;
|
||||
|
@ -70,8 +70,8 @@ public class TocTreeModel implements TreeModel {
|
||||
return tree.keySet().toArray()[index];
|
||||
}
|
||||
if (parent instanceof String) {
|
||||
if (tree.get((String) parent) != null) {
|
||||
return tree.get((String) parent).values().toArray()[index];
|
||||
if (tree.get(parent) != null) {
|
||||
return tree.get(parent).values().toArray()[index];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -82,8 +82,8 @@ public class TocTreeModel implements TreeModel {
|
||||
return tree.keySet().size();
|
||||
}
|
||||
if (twoLevel && parent instanceof String) {
|
||||
if (tree.get((String) parent) != null) {
|
||||
return tree.get((String) parent).values().size();
|
||||
if (tree.get(parent) != null) {
|
||||
return tree.get(parent).values().size();
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ public class TocTreeModel implements TreeModel {
|
||||
if (parent instanceof String) {
|
||||
String n = (String) parent;
|
||||
int index = 0;
|
||||
for (String c : tree.get((String) parent).keySet()) {
|
||||
for (String c : tree.get(parent).keySet()) {
|
||||
if (c.equals(child)) {
|
||||
return index;
|
||||
}
|
||||
|
@ -160,9 +160,9 @@ public class StateManager implements Reconfigurable {
|
||||
// more sophosticated.
|
||||
Class type = node.getCurrentValue().getClass();
|
||||
if (PagedMemory.class.isAssignableFrom(type)) {
|
||||
addMemoryPages((ObjectGraphNode<PagedMemory>) node, f);
|
||||
addMemoryPages(node, f);
|
||||
} else if (BufferedImage.class.isAssignableFrom(type)) {
|
||||
addVideoFrame((ObjectGraphNode<BufferedImage>) node, f);
|
||||
addVideoFrame(node, f);
|
||||
} else if (List.class.isAssignableFrom(type)) {
|
||||
List l = (List) node.getCurrentValue();
|
||||
Type fieldGenericType = f.getGenericType();
|
||||
|
@ -36,6 +36,7 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.text.JTextComponent;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -150,7 +151,7 @@ public class EditableLabel extends JPanel implements MouseListener, FocusListene
|
||||
private void deactivateEdit() {
|
||||
isEditing = false;
|
||||
if (editComponent instanceof JTextField) {
|
||||
String value = ((JTextField) editComponent).getText();
|
||||
String value = ((JTextComponent) editComponent).getText();
|
||||
if (value != null) {
|
||||
value = value.trim();
|
||||
if (value.length() > width) {
|
||||
@ -165,10 +166,10 @@ public class EditableLabel extends JPanel implements MouseListener, FocusListene
|
||||
}
|
||||
if (value == null || value.equals("")) {
|
||||
showBlankValue();
|
||||
((JTextField) editComponent).setText(null);
|
||||
((JTextComponent) editComponent).setText(null);
|
||||
} else {
|
||||
labelComponent.setText(value);
|
||||
((JTextField) editComponent).setText(value.trim());
|
||||
((JTextComponent) editComponent).setText(value.trim());
|
||||
}
|
||||
} else if (editComponent instanceof JComboBox) {
|
||||
ImageIcon selection = (ImageIcon) ((JComboBox) editComponent).getSelectedItem();
|
||||
|
Loading…
x
Reference in New Issue
Block a user