Skip to content

Instantly share code, notes, and snippets.

@barttenbrinke
Created August 21, 2012 09:01
Show Gist options
  • Save barttenbrinke/3413754 to your computer and use it in GitHub Desktop.
Save barttenbrinke/3413754 to your computer and use it in GitHub Desktop.
Tr fix?
diff --git a/vm/builtin/string.cpp b/vm/builtin/string.cpp
index 49e5628..52e7848 100644
--- a/vm/builtin/string.cpp
+++ b/vm/builtin/string.cpp
@@ -944,20 +944,9 @@ namespace rubinius {
native_int limit;
bool assign(native_int chr) {
- int j, i = set[chr];
-
if(limit >= 0 && steps >= limit) return true;
- if(i < 0) {
- tr[last] = chr;
- } else {
- last--;
- for(j = i + 1; j <= last; j++) {
- set[tr[j]]--;
- tr[j-1] = tr[j];
- }
- tr[last] = chr;
- }
+ tr[last] = chr;
set[chr] = last++;
steps++;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment