aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-06-29 11:25:15 +0300
committermax99x <max99x@gmail.com>2011-06-29 11:25:15 +0300
commitdba00a5c7c028edfda20dcb79f625fc9f9744442 (patch)
tree81074175336dc2a8d56a93cd049ab9d0c937d699 /src/library.js
parent70edb25e68b311d4cdfc33463c9eb42793cd39ca (diff)
Minor polish:
* Removed auto-added `.js` from dynamically loaded libs. * Removed redundant bit fiddling in _formatString. Uses unSign/reSign instead.
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/library.js b/src/library.js
index 284f093d..db76d39d 100644
--- a/src/library.js
+++ b/src/library.js
@@ -210,19 +210,9 @@ var Library = {
var currArg = getNextArg(false, argSize);
// Truncate to requested size.
argSize = argSize || 4;
- var limit = undefined;
- if (argSize == 4) {
- limit = 0xFFFFFFFF;
- } else if (argSize == 2) {
- limit = 0xFFFF;
- } else if (argSize == 1) {
- limit = 0xFF;
- }
- if (limit !== undefined) {
- currArg = currArg & limit;
- if (!signed && currArg < 0 || signed && currArg > (limit - 1) / 2) {
- currArg = ~(limit - currArg);
- }
+ if (argSize <= 4) {
+ var limit = Math.pow(256, argSize) - 1;
+ currArg = (signed ? reSign : unSign)(currArg & limit, argSize * 8);
}
// Format the number.
var currAbsArg = Math.abs(currArg);
@@ -1491,7 +1481,6 @@ var Library = {
dlopen: function(filename, flag) {
// TODO: Add support for LD_LIBRARY_PATH.
filename = Pointer_stringify(filename);
- filename += '.js';
if (DLFCN_DATA.loadedLibNames[filename]) {
// Already loaded; increment ref count and return.