Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Draper matthewd

View GitHub Profile
View gist:314549
From ad920f9466238692614d510e165f94c8bcdec838 Mon Sep 17 00:00:00 2001
From: Matthew Draper <matthew@trebex.net>
Date: Fri, 26 Feb 2010 00:16:35 +1030
Subject: [PATCH] Remove duplicate module_function call in kernel.rb
Cleans up a copy & paste error I introduced two years ago.
---
kernel/common/kernel.rb | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
View gist:331803
From e31a244f78dfcdeef1381a24a657a6779792767c Mon Sep 17 00:00:00 2001
From: Matthew Draper <matthew@trebex.net>
Date: Sat, 13 Mar 2010 19:26:58 +1030
Subject: [PATCH 1/3] Correctly handle large numeric Config values.
Previously, values > Fixnum::MAX would behave incorrectly.
In passing, also fix handling of negative values: don't strip their
sign(!), but still treat them as numeric.
---
View gist:331810
From 7b4f0646096edb78b4ca48ba028576fded3369d0 Mon Sep 17 00:00:00 2001
From: Matthew Draper <matthew@trebex.net>
Date: Sun, 14 Mar 2010 15:28:39 +1030
Subject: [PATCH] Improve & extend Kernel.{rand,srand} specs.
---
spec/ruby/core/kernel/rand_spec.rb | 101 +++++++++++++++++++++++++++++++----
spec/ruby/core/kernel/srand_spec.rb | 35 +++++++++++--
2 files changed, 121 insertions(+), 15 deletions(-)
View gist:334965
From 695d27766eeff690dd530e9bc1933365367ed85d Mon Sep 17 00:00:00 2001
From: Matthew Draper <matthew@trebex.net>
Date: Sat, 10 Apr 2010 02:51:26 +0930
Subject: [PATCH] Improved Kernel.{rand,srand} implementation.
Doesn't yet produce extra randomness to properly fill a bignum range.
---
benchmark/rubinius/bm_random.rb | 50 ++++++++++++++++++
kernel/common/kernel.rb | 64 +++++++----------------
kernel/common/load_order.txt | 1 +
View gist:335927
require 'benchmark'
total = (ENV['TOTAL'] || 10_000).to_i
unless defined?(Rubinius)
module Rubinius
Tuple = Array
WORDSIZE = 32
end
class Fixnum
View 0001-C-Kernel.-rand-srand-implementation.patch
From 1dde9f8ed1eb9fab95cc974c1da00e61c8426a80 Mon Sep 17 00:00:00 2001
From: Matthew Draper <matthew@trebex.net>
Date: Thu, 15 Apr 2010 13:16:04 +0930
Subject: [PATCH 1/3] C++ Kernel.{rand,srand} implementation
---
benchmark/rubinius/bm_random.rb | 50 ++++++
kernel/common/kernel.rb | 58 ++-----
kernel/common/load_order.txt | 1 +
kernel/common/random.rb | 47 +++++
View gist:361526
From 78de83ee04902e003647369c55dd85ff1b58238f Mon Sep 17 00:00:00 2001
From: Matthew Draper <matthew@trebex.net>
Date: Sat, 10 Apr 2010 05:29:35 +0930
Subject: [PATCH] Revised 'add a builtin class' howto
---
doc/howto/add_a_builtin_class.txt | 213 ++++++++++++++++++++++---------------
1 files changed, 128 insertions(+), 85 deletions(-)
diff --git a/doc/howto/add_a_builtin_class.txt b/doc/howto/add_a_builtin_class.txt
View gist:365974
From f6d8117aca381769d300339acb38200d3aa1524f Mon Sep 17 00:00:00 2001
From: Matthew Draper <matthew@trebex.net>
Date: Thu, 15 Apr 2010 01:09:43 +0930
Subject: [PATCH] Uglier, but more portable? -- use explicit types
---
vm/builtin/bignum.cpp | 16 +++---
vm/builtin/bignum.hpp | 4 +-
vm/builtin/randomizer.cpp | 105 ++++++++++++++++++++++++---------------------
vm/builtin/randomizer.hpp | 10 ++--
View gist:366111
From 64424b2d80a45d8ac9d90fd3766b63c8f5f47b12 Mon Sep 17 00:00:00 2001
From: Matthew Draper <matthew@trebex.net>
Date: Thu, 15 Apr 2010 03:23:27 +0930
Subject: [PATCH] C++ Kernel.{rand,srand} implementation
---
benchmark/rubinius/bm_random.rb | 50 ++++++
kernel/common/kernel.rb | 58 ++-----
kernel/common/load_order.txt | 1 +
kernel/common/random.rb | 47 +++++
View gist:371845
From fe0b71f4fd860ec3cff4b25d6b61a30d1a04f63f Mon Sep 17 00:00:00 2001
From: Matthew Draper <matthew@trebex.net>
Date: Tue, 20 Apr 2010 09:48:28 +0930
Subject: [PATCH] Tidy up randomizer a bit
* Prune includes down to what's actually needed
* Define and use a native_uint instead of uintptr_t
* Don't need to check the result of into_array; that paranoia was only
really warranted when independently "guessing" the correct length
* Don't assume an alloca() will persist outside the scope it's called