Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some of the removed redundant casts aren't so redundant after all #388

Open
Machine-Maker opened this issue May 3, 2024 · 1 comment
Open
Labels
bug Something isn't working Priority: Medium Medium priority regression Used to work before, but doesn't now Subsystem: Statement Structure Anything concerning how statements are structured in a method

Comments

@Machine-Maker
Copy link

Vineflower version

1.11.0-20240501.032551-24

Describe the bug

Previous versions of VF had casts to long in places that are required for Minecraft source to run. It compiles, but errors on startup.

Additional information

Index: net/minecraft/world/level/levelgen/BitRandomSource.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/net/minecraft/world/level/levelgen/BitRandomSource.java b/net/minecraft/world/level/levelgen/BitRandomSource.java
--- a/net/minecraft/world/level/levelgen/BitRandomSource.java    (revision 945cfbb91d450971c7076db24b5a76a4ea97cd0c)
+++ b/net/minecraft/world/level/levelgen/BitRandomSource.java    (date 1714775725817)
@@ -18,7 +18,7 @@
         if (bound <= 0) {
             throw new IllegalArgumentException("Bound must be positive");
         } else if ((bound & bound - 1) == 0) {
-            return (int)(bound * this.next(31) >> 31);
+            return (int)((long)bound * (long)this.next(31) >> 31);
         } else {
             int i;
             int i1;

this is a fix required with the above version of VF in order to make the game run. (re-adding the (long) casts).

@Machine-Maker Machine-Maker added the bug Something isn't working label May 3, 2024
@Machine-Maker
Copy link
Author

I just added a small thing to the tests that now fail which show the issue more directly. https://github.com/Machine-Maker/vineflower/tree/demo/cast-issue

@jaskarth jaskarth added Subsystem: Statement Structure Anything concerning how statements are structured in a method Priority: Medium Medium priority regression Used to work before, but doesn't now labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority: Medium Medium priority regression Used to work before, but doesn't now Subsystem: Statement Structure Anything concerning how statements are structured in a method
Projects
None yet
Development

No branches or pull requests

2 participants