Skip to content

Instantly share code, notes, and snippets.

@headius
Last active November 20, 2025 00:39
Show Gist options
  • Select an option

  • Save headius/2ec73f80573a25e93344214bf6c5ae86 to your computer and use it in GitHub Desktop.

Select an option

Save headius/2ec73f80573a25e93344214bf6c5ae86 to your computer and use it in GitHub Desktop.
// This code was generated by AI. It's completely wrong.
public static RubyFixnum newFixnum(Ruby runtime, long value) {
if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) {
return newFixnum(runtime, (byte) value);
} else if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {
return newFixnum(runtime, (short) value);
} else if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {
return newFixnum(runtime, (int) value);
}
return USE_CACHE && isInCacheRange(value) ?
cachedFixnum(runtime, value) :
new LongFixnum(runtime.getInteger(), value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment