Created
November 28, 2010 00:24
-
-
Save zeen/718427 to your computer and use it in GitHub Desktop.
Adds Math.frexp, Math.ldexp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function waqas_MattyMath(){ | |
var $wnd_0 = window, $doc_0 = document, gwtOnLoad, bodyDone, base = '', metaProps = {}, values = [], providers = [], answers = [], onLoadErrorFunc, propertyErrorFunc; | |
if (!$wnd_0.__gwt_stylesLoaded) { | |
$wnd_0.__gwt_stylesLoaded = {}; | |
} | |
if (!$wnd_0.__gwt_scriptsLoaded) { | |
$wnd_0.__gwt_scriptsLoaded = {}; | |
} | |
function isHostedMode(){ | |
var result = false; | |
try { | |
var query = $wnd_0.location.search; | |
return (query.indexOf('gwt.codesvr=') != -1 || (query.indexOf('gwt.hosted=') != -1 || $wnd_0.external && $wnd_0.external.gwtOnLoad)) && query.indexOf('gwt.hybrid') == -1; | |
} | |
catch (e) { | |
} | |
isHostedMode = function(){ | |
return result; | |
} | |
; | |
return result; | |
} | |
function maybeStartModule(){ | |
if (gwtOnLoad && bodyDone) { | |
gwtOnLoad(onLoadErrorFunc, 'waqas.MattyMath', base); | |
} | |
} | |
function computeScriptBase(){ | |
var thisScript, markerId = '__gwt_marker_waqas.MattyMath', markerScript; | |
$doc_0.write('<script id="' + markerId + '"><\/script>'); | |
markerScript = $doc_0.getElementById(markerId); | |
thisScript = markerScript && markerScript.previousSibling; | |
while (thisScript && thisScript.tagName != 'SCRIPT') { | |
thisScript = thisScript.previousSibling; | |
} | |
function getDirectoryOfFile(path){ | |
var hashIndex = path.lastIndexOf('#'); | |
if (hashIndex == -1) { | |
hashIndex = path.length; | |
} | |
var queryIndex = path.indexOf('?'); | |
if (queryIndex == -1) { | |
queryIndex = path.length; | |
} | |
var slashIndex = path.lastIndexOf('/', Math.min(queryIndex, hashIndex)); | |
return slashIndex >= 0?path.substring(0, slashIndex + 1):''; | |
} | |
; | |
if (thisScript && thisScript.src) { | |
base = getDirectoryOfFile(thisScript.src); | |
} | |
if (base == '') { | |
var baseElements = $doc_0.getElementsByTagName('base'); | |
if (baseElements.length > 0) { | |
base = baseElements[baseElements.length - 1].href; | |
} | |
else { | |
base = getDirectoryOfFile($doc_0.location.href); | |
} | |
} | |
else if (base.match(/^\w+:\/\//)) { | |
} | |
else { | |
var img = $doc_0.createElement('img'); | |
img.src = base + 'clear.cache.gif'; | |
base = getDirectoryOfFile(img.src); | |
} | |
if (markerScript) { | |
markerScript.parentNode.removeChild(markerScript); | |
} | |
} | |
function processMetas(){ | |
var metas = document.getElementsByTagName('meta'); | |
for (var i = 0, n = metas.length; i < n; ++i) { | |
var meta = metas[i], name_0 = meta.getAttribute('name'), content_0; | |
if (name_0) { | |
if (name_0 == 'gwt:property') { | |
content_0 = meta.getAttribute('content'); | |
if (content_0) { | |
var value, eq = content_0.indexOf('='); | |
if (eq >= 0) { | |
name_0 = content_0.substring(0, eq); | |
value = content_0.substring(eq + 1); | |
} | |
else { | |
name_0 = content_0; | |
value = ''; | |
} | |
metaProps[name_0] = value; | |
} | |
} | |
else if (name_0 == 'gwt:onPropertyErrorFn') { | |
content_0 = meta.getAttribute('content'); | |
if (content_0) { | |
try { | |
propertyErrorFunc = eval(content_0); | |
} | |
catch (e) { | |
alert('Bad handler "' + content_0 + '" for "gwt:onPropertyErrorFn"'); | |
} | |
} | |
} | |
else if (name_0 == 'gwt:onLoadErrorFn') { | |
content_0 = meta.getAttribute('content'); | |
if (content_0) { | |
try { | |
onLoadErrorFunc = eval(content_0); | |
} | |
catch (e) { | |
alert('Bad handler "' + content_0 + '" for "gwt:onLoadErrorFn"'); | |
} | |
} | |
} | |
} | |
} | |
} | |
waqas_MattyMath.onScriptLoad = function(gwtOnLoadFunc){ | |
waqas_MattyMath = null; | |
gwtOnLoad = gwtOnLoadFunc; | |
maybeStartModule(); | |
} | |
; | |
if (isHostedMode()) { | |
alert('Single-script hosted mode not yet implemented. See issue ' + 'http://code.google.com/p/google-web-toolkit/issues/detail?id=2079'); | |
return; | |
} | |
computeScriptBase(); | |
processMetas(); | |
var onBodyDoneTimerId; | |
function onBodyDone(){ | |
if (!bodyDone) { | |
bodyDone = true; | |
maybeStartModule(); | |
if ($doc_0.removeEventListener) { | |
$doc_0.removeEventListener('DOMContentLoaded', onBodyDone, false); | |
} | |
if (onBodyDoneTimerId) { | |
clearInterval(onBodyDoneTimerId); | |
} | |
} | |
} | |
if ($doc_0.addEventListener) { | |
$doc_0.addEventListener('DOMContentLoaded', function(){ | |
onBodyDone(); | |
} | |
, false); | |
} | |
var onBodyDoneTimerId = setInterval(function(){ | |
if (/loaded|complete/.test($doc_0.readyState)) { | |
onBodyDone(); | |
} | |
} | |
, 50); | |
} | |
waqas_MattyMath(); | |
(function () {var $gwt_version = "2.1.0";var $wnd = window;var $doc = $wnd.document;var $moduleName, $moduleBase;var $stats = $wnd.__gwtStatsEvent ? function(a) {$wnd.__gwtStatsEvent(a)} : null;var $strongName = '96C2A9145821910737646C6FF28A819D';var _, N8000000000000000_longLit = {l:0, m:0, h:524288}, N7ff0000000000001_longLit = {l:4194303, m:4194303, h:524543}, P0_longLit = {l:0, m:0, h:0}, P3ff_longLit = {l:1023, m:0, h:0}, P7ff_longLit = {l:2047, m:0, h:0}, Pfffffffffffff_longLit = {l:4194303, m:4194303, h:255}, P3fe0000000000000_longLit = {l:0, m:0, h:261632}, P7ff0000000000000_longLit = {l:0, m:0, h:524032}, P7ff8000000000000_longLit = {l:0, m:0, h:524160}; | |
function nullMethod(){ | |
} | |
function Object_0(){ | |
} | |
_ = Object_0.prototype = {}; | |
_.typeMarker$ = nullMethod; | |
_.castableTypeMap$ = {}; | |
function $setStackTrace(stackTrace){ | |
var c, copy, i; | |
copy = initDim(_3Ljava_lang_StackTraceElement_2_classLit, {}, 0, stackTrace.length, 0); | |
for (i = 0 , c = stackTrace.length; i < c; ++i) { | |
if (!stackTrace[i]) { | |
throw new NullPointerException_0; | |
} | |
copy[i] = stackTrace[i]; | |
} | |
} | |
function Throwable(){ | |
} | |
_ = Throwable.prototype = new Object_0; | |
_.castableTypeMap$ = {3:1}; | |
function Exception(){ | |
} | |
_ = Exception.prototype = new Throwable; | |
_.castableTypeMap$ = {3:1}; | |
function RuntimeException(){ | |
} | |
_ = RuntimeException.prototype = new Exception; | |
_.castableTypeMap$ = {2:1, 3:1}; | |
function JavaScriptException_0(e){ | |
$fillInStackTrace(); | |
this.e = e; | |
$createStackTrace(this); | |
} | |
function JavaScriptException(){ | |
} | |
_ = JavaScriptException_0.prototype = JavaScriptException.prototype = new RuntimeException; | |
_.castableTypeMap$ = {2:1, 3:1}; | |
_.e = null; | |
function Scheduler(){ | |
} | |
_ = Scheduler.prototype = new Object_0; | |
_.castableTypeMap$ = {}; | |
function enter(){ | |
if (entryDepth++ == 0) { | |
$flushEntryCommands(($clinit_10() , INSTANCE)); | |
return true; | |
} | |
return false; | |
} | |
function entry(jsFunction){ | |
return function(){ | |
try { | |
return entry0(jsFunction, this, arguments); | |
} | |
catch (e) { | |
throw e; | |
} | |
} | |
; | |
} | |
function entry0(jsFunction, thisObj, arguments_0){ | |
var initialEntry; | |
initialEntry = enter(); | |
try { | |
return jsFunction.apply(thisObj, arguments_0); | |
} | |
finally { | |
initialEntry && $flushFinallyCommands(($clinit_10() , INSTANCE)); | |
--entryDepth; | |
} | |
} | |
var entryDepth = 0; | |
function $clinit_10(){ | |
$clinit_10 = nullMethod; | |
INSTANCE = new SchedulerImpl_0; | |
} | |
function $flushEntryCommands(this$static){ | |
var oldQueue, rescheduled; | |
if (this$static.entryCommands) { | |
rescheduled = null; | |
do { | |
oldQueue = this$static.entryCommands; | |
this$static.entryCommands = null; | |
rescheduled = runScheduledTasks(oldQueue, rescheduled); | |
} | |
while (this$static.entryCommands); | |
this$static.entryCommands = rescheduled; | |
} | |
} | |
function $flushFinallyCommands(this$static){ | |
var oldQueue, rescheduled; | |
if (this$static.finallyCommands) { | |
rescheduled = null; | |
do { | |
oldQueue = this$static.finallyCommands; | |
this$static.finallyCommands = null; | |
rescheduled = runScheduledTasks(oldQueue, rescheduled); | |
} | |
while (this$static.finallyCommands); | |
this$static.finallyCommands = rescheduled; | |
} | |
} | |
function SchedulerImpl_0(){ | |
} | |
function push(queue, task){ | |
!queue && (queue = []); | |
queue[queue.length] = task; | |
return queue; | |
} | |
function runScheduledTasks(tasks, rescheduled){ | |
var $e0, i, j, t; | |
for (i = 0 , j = tasks.length; i < j; ++i) { | |
t = tasks[i]; | |
try { | |
t[1]?t[0].nullMethod() && (rescheduled = push(rescheduled, t)):t[0].nullMethod(); | |
} | |
catch ($e0) { | |
$e0 = caught($e0); | |
if (!instanceOf($e0, 2)) | |
throw $e0; | |
} | |
} | |
return rescheduled; | |
} | |
function SchedulerImpl(){ | |
} | |
_ = SchedulerImpl_0.prototype = SchedulerImpl.prototype = new Scheduler; | |
_.castableTypeMap$ = {}; | |
_.entryCommands = null; | |
_.finallyCommands = null; | |
var INSTANCE; | |
function extractNameFromToString(fnToString){ | |
var index, start, toReturn; | |
toReturn = ''; | |
fnToString = $trim(fnToString); | |
index = fnToString.indexOf('('); | |
if (index != -1) { | |
start = fnToString.indexOf('function') == 0?8:0; | |
toReturn = $trim(fnToString.substr(start, index - start)); | |
} | |
return toReturn.length > 0?toReturn:'anonymous'; | |
} | |
function $collect(this$static){ | |
var seen = {}; | |
var toReturn = []; | |
var callee = arguments.callee.caller.caller; | |
while (callee) { | |
var name_0 = this$static.extractName(callee.toString()); | |
toReturn.push(name_0); | |
var keyName = ':' + name_0; | |
var withThisName = seen[keyName]; | |
if (withThisName) { | |
var i, j; | |
for (i = 0 , j = withThisName.length; i < j; i++) { | |
if (withThisName[i] === callee) { | |
return toReturn; | |
} | |
} | |
} | |
(withThisName || (seen[keyName] = [])).push(callee); | |
callee = callee.caller; | |
} | |
return toReturn; | |
} | |
function $createStackTrace(e){ | |
var i, j, stack, stackTrace; | |
stack = (instanceOfJso(e.e)?dynamicCastJso(e.e):null , []); | |
stackTrace = initDim(_3Ljava_lang_StackTraceElement_2_classLit, {}, 0, stack.length, 0); | |
for (i = 0 , j = stackTrace.length; i < j; ++i) { | |
stackTrace[i] = new StackTraceElement_0(stack[i]); | |
} | |
$setStackTrace(stackTrace); | |
} | |
function $fillInStackTrace(){ | |
var i, j, stack, stackTrace; | |
stack = $collect(new StackTraceCreator$Collector_0); | |
stackTrace = initDim(_3Ljava_lang_StackTraceElement_2_classLit, {}, 0, stack.length, 0); | |
for (i = 0 , j = stackTrace.length; i < j; ++i) { | |
stackTrace[i] = new StackTraceElement_0(stack[i]); | |
} | |
$setStackTrace(stackTrace); | |
} | |
function StackTraceCreator$Collector_0(){ | |
} | |
function StackTraceCreator$Collector(){ | |
} | |
_ = StackTraceCreator$Collector_0.prototype = StackTraceCreator$Collector.prototype = new Object_0; | |
_.extractName = function(fnToString){ | |
return extractNameFromToString(fnToString); | |
} | |
; | |
_.castableTypeMap$ = {}; | |
function Array_1(){ | |
} | |
function createFromSeed(seedType, length_0){ | |
var array = new Array(length_0); | |
if (seedType == 3) { | |
for (var i = 0; i < length_0; ++i) { | |
var value = new Object; | |
value.l = value.m = value.h = 0; | |
array[i] = value; | |
} | |
} | |
else if (seedType > 0) { | |
var value = [null, 0, false][seedType]; | |
for (var i = 0; i < length_0; ++i) { | |
array[i] = value; | |
} | |
} | |
return array; | |
} | |
function initDim(arrayClass, castableTypeMap, queryId, length_0, seedType){ | |
var result; | |
result = createFromSeed(seedType, length_0); | |
$clinit_15(); | |
wrapArray(result, expandoNames_0, expandoValues_0); | |
result.castableTypeMap$ = castableTypeMap; | |
return result; | |
} | |
function initValues(arrayClass, castableTypeMap, queryId, array){ | |
$clinit_15(); | |
wrapArray(array, expandoNames_0, expandoValues_0); | |
array.castableTypeMap$ = castableTypeMap; | |
return array; | |
} | |
function Array_0(){ | |
} | |
_ = Array_1.prototype = Array_0.prototype = new Object_0; | |
_.castableTypeMap$ = {}; | |
function $clinit_15(){ | |
$clinit_15 = nullMethod; | |
expandoNames_0 = []; | |
expandoValues_0 = []; | |
initExpandos(new Array_1, expandoNames_0, expandoValues_0); | |
} | |
function initExpandos(protoType, expandoNames, expandoValues){ | |
var i = 0, value; | |
for (var name_0 in protoType) { | |
if (value = protoType[name_0]) { | |
expandoNames[i] = name_0; | |
expandoValues[i] = value; | |
++i; | |
} | |
} | |
} | |
function wrapArray(array, expandoNames, expandoValues){ | |
$clinit_15(); | |
for (var i = 0, c = expandoNames.length; i < c; ++i) { | |
array[expandoNames[i]] = expandoValues[i]; | |
} | |
} | |
var expandoNames_0, expandoValues_0; | |
function dynamicCastJso(src){ | |
if (src != null && (src.typeMarker$ == nullMethod || src.castableTypeMap$ && !!src.castableTypeMap$[1])) { | |
throw new ClassCastException_0; | |
} | |
return src; | |
} | |
function instanceOf(src, dstId){ | |
return src != null && src.castableTypeMap$ && !!src.castableTypeMap$[dstId]; | |
} | |
function instanceOfJso(src){ | |
return src != null && src.typeMarker$ != nullMethod && !(src.castableTypeMap$ && !!src.castableTypeMap$[1]); | |
} | |
function round_int(x){ | |
return ~~Math.max(Math.min(x, 2147483647), -2147483648); | |
} | |
function init(){ | |
!!$stats && $stats({moduleName:$moduleName, sessionId:$sessionId, subSystem:'startup', evtGroup:'moduleStartup', millis:(new Date).getTime(), type:'onModuleLoadStart', className:'waqas.client.MattyMath'}); | |
$wnd.Math.ldexp = ldexp; | |
$wnd.Math.frexp = frexp_0; | |
} | |
function caught(e){ | |
if (e != null && e.castableTypeMap$ && !!e.castableTypeMap$[3]) { | |
return e; | |
} | |
return new JavaScriptException_0(e); | |
} | |
function create(value){ | |
var a0, a1, a2; | |
a0 = value & 4194303; | |
a1 = ~~value >> 22 & 4194303; | |
a2 = value < 0?1048575:0; | |
return a = new LongLibBase$LongEmul_0 , a.l = a0 , a.m = a1 , a.h = a2 , a; | |
} | |
function create0(l_0, m_0, h_0){ | |
return a = new LongLibBase$LongEmul_0 , a.l = l_0 , a.m = m_0 , a.h = h_0 , a; | |
} | |
function toDoubleHelper(a_0){ | |
return a_0.l + a_0.m * 4194304 + a_0.h * 17592186044416; | |
} | |
function add(a_0, b){ | |
var sum0, sum1, sum2; | |
sum0 = a_0.l + b.l; | |
sum1 = a_0.m + b.m + (~~sum0 >> 22); | |
sum2 = a_0.h + b.h + (~~sum1 >> 22); | |
return create0(sum0 & 4194303, sum1 & 4194303, sum2 & 1048575); | |
} | |
function and(a_0, b){ | |
return create0(a_0.l & b.l, a_0.m & b.m, a_0.h & b.h); | |
} | |
function eq(a_0, b){ | |
return a_0.l == b.l && a_0.m == b.m && a_0.h == b.h; | |
} | |
function fromDouble(value){ | |
var a0, a1, a2, negative, result, neg0, neg1, neg2; | |
if (isNaN(value)) { | |
return $clinit_22() , ZERO; | |
} | |
if (value < -9223372036854775808) { | |
return $clinit_22() , MIN_VALUE; | |
} | |
if (value >= 9223372036854775807) { | |
return $clinit_22() , MAX_VALUE; | |
} | |
negative = false; | |
if (value < 0) { | |
negative = true; | |
value = -value; | |
} | |
a2 = 0; | |
if (value >= 17592186044416) { | |
a2 = ~~Math.max(Math.min(value / 17592186044416, 2147483647), -2147483648); | |
value -= a2 * 17592186044416; | |
} | |
a1 = 0; | |
if (value >= 4194304) { | |
a1 = ~~Math.max(Math.min(value / 4194304, 2147483647), -2147483648); | |
value -= a1 * 4194304; | |
} | |
a0 = ~~Math.max(Math.min(value, 2147483647), -2147483648); | |
result = (a = new LongLibBase$LongEmul_0 , a.l = a0 , a.m = a1 , a.h = a2 , a); | |
negative && (neg0 = ~result.l + 1 & 4194303 , neg1 = ~result.m + (neg0 == 0?1:0) & 4194303 , neg2 = ~result.h + (neg0 == 0 && neg1 == 0?1:0) & 1048575 , result.l = neg0 , result.m = neg1 , result.h = neg2 , undefined); | |
return result; | |
} | |
function fromInt(value){ | |
var rebase, result; | |
if (value > -129 && value < 128) { | |
rebase = value + 128; | |
boxedValues == null && (boxedValues = initDim(_3Lcom_google_gwt_lang_LongLibBase$LongEmul_2_classLit, {}, 0, 256, 0)); | |
result = boxedValues[rebase]; | |
!result && (result = boxedValues[rebase] = create(value)); | |
return result; | |
} | |
return create(value); | |
} | |
function gte(a_0, b){ | |
var signa, signb; | |
signa = ~~a_0.h >> 19; | |
signb = ~~b.h >> 19; | |
return signa == 0?signb != 0 || a_0.h > b.h || a_0.h == b.h && a_0.m > b.m || a_0.h == b.h && a_0.m == b.m && a_0.l >= b.l:!(signb == 0 || a_0.h < b.h || a_0.h == b.h && a_0.m < b.m || a_0.h == b.h && a_0.m == b.m && a_0.l < b.l); | |
} | |
function lte(a_0, b){ | |
var signa, signb; | |
return !(signa = ~~a_0.h >> 19 , signb = ~~b.h >> 19 , signa == 0?signb != 0 || a_0.h > b.h || a_0.h == b.h && a_0.m > b.m || a_0.h == b.h && a_0.m == b.m && a_0.l > b.l:!(signb == 0 || a_0.h < b.h || a_0.h == b.h && a_0.m < b.m || a_0.h == b.h && a_0.m == b.m && a_0.l <= b.l)); | |
} | |
function neq(a_0, b){ | |
return a_0.l != b.l || a_0.m != b.m || a_0.h != b.h; | |
} | |
function or(a_0, b){ | |
return create0(a_0.l | b.l, a_0.m | b.m, a_0.h | b.h); | |
} | |
function shl(a_0, n){ | |
var res0, res1, res2; | |
n &= 63; | |
if (n < 22) { | |
res0 = a_0.l << n; | |
res1 = a_0.m << n | ~~a_0.l >> 22 - n; | |
res2 = a_0.h << n | ~~a_0.m >> 22 - n; | |
} | |
else if (n < 44) { | |
res0 = 0; | |
res1 = a_0.l << n - 22; | |
res2 = a_0.m << n - 22 | ~~a_0.l >> 44 - n; | |
} | |
else { | |
res0 = 0; | |
res1 = 0; | |
res2 = a_0.l << n - 44; | |
} | |
return create0(res0 & 4194303, res1 & 4194303, res2 & 1048575); | |
} | |
function shr(a_0, n){ | |
var a2, negative, res0, res1, res2; | |
n &= 63; | |
a2 = a_0.h; | |
negative = (a2 & 524288) != 0; | |
negative && (a2 |= -1048576); | |
if (n < 22) { | |
res2 = ~~a2 >> n; | |
res1 = ~~a_0.m >> n | a2 << 22 - n; | |
res0 = ~~a_0.l >> n | a_0.m << 22 - n; | |
} | |
else if (n < 44) { | |
res2 = negative?1048575:0; | |
res1 = ~~a2 >> n - 22; | |
res0 = ~~a_0.m >> n - 22 | a2 << 44 - n; | |
} | |
else { | |
res2 = negative?1048575:0; | |
res1 = negative?4194303:0; | |
res0 = ~~a2 >> n - 44; | |
} | |
return create0(res0 & 4194303, res1 & 4194303, res2 & 1048575); | |
} | |
function toDouble(a_0){ | |
var neg0, neg1, neg2; | |
if (eq(a_0, ($clinit_22() , MIN_VALUE))) { | |
return -9223372036854775808; | |
} | |
if (!gte(a_0, ZERO)) { | |
return -toDoubleHelper((neg0 = ~a_0.l + 1 & 4194303 , neg1 = ~a_0.m + (neg0 == 0?1:0) & 4194303 , neg2 = ~a_0.h + (neg0 == 0 && neg1 == 0?1:0) & 1048575 , create0(neg0, neg1, neg2))); | |
} | |
return a_0.l + a_0.m * 4194304 + a_0.h * 17592186044416; | |
} | |
function toInt(a_0){ | |
return a_0.l | a_0.m << 22; | |
} | |
var boxedValues = null; | |
function $clinit_22(){ | |
$clinit_22 = nullMethod; | |
MAX_VALUE = (a = new LongLibBase$LongEmul_0 , a.l = 4194303 , a.m = 4194303 , a.h = 524287 , a); | |
MIN_VALUE = (a = new LongLibBase$LongEmul_0 , a.l = 0 , a.m = 0 , a.h = 524288 , a); | |
fromInt(1); | |
fromInt(2); | |
ZERO = fromInt(0); | |
} | |
var MAX_VALUE, MIN_VALUE, ZERO; | |
function LongLibBase$LongEmul_0(){ | |
} | |
function LongLibBase$LongEmul(){ | |
} | |
_ = LongLibBase$LongEmul_0.prototype = LongLibBase$LongEmul.prototype = new Object_0; | |
_.castableTypeMap$ = {}; | |
function Class_0(){ | |
} | |
function Class(){ | |
} | |
_ = Class_0.prototype = Class.prototype = new Object_0; | |
_.castableTypeMap$ = {}; | |
function ClassCastException_0(){ | |
$fillInStackTrace(); | |
} | |
function ClassCastException(){ | |
} | |
_ = ClassCastException_0.prototype = ClassCastException.prototype = new RuntimeException; | |
_.castableTypeMap$ = {2:1, 3:1}; | |
function floor(x){ | |
return Math.floor(x); | |
} | |
function NullPointerException_0(){ | |
$fillInStackTrace(); | |
} | |
function NullPointerException(){ | |
} | |
_ = NullPointerException_0.prototype = NullPointerException.prototype = new RuntimeException; | |
_.castableTypeMap$ = {2:1, 3:1}; | |
function StackTraceElement_0(methodName){ | |
} | |
function StackTraceElement(){ | |
} | |
_ = StackTraceElement_0.prototype = StackTraceElement.prototype = new Object_0; | |
_.castableTypeMap$ = {}; | |
function $trim(this$static){ | |
if (this$static.length == 0 || this$static[0] > ' ' && this$static[this$static.length - 1] > ' ') { | |
return this$static; | |
} | |
var r1 = this$static.replace(/^(\s*)/, ''); | |
var r2 = r1.replace(/\s*$/, ''); | |
return r2; | |
} | |
_ = String.prototype; | |
_.castableTypeMap$ = {1:1}; | |
function frexp_0(d){ | |
var ep, frexp, x; | |
if (isNaN(d)) | |
return initValues(_3D_classLit, {}, -1, [d, -1]); | |
frexp = 0; | |
if (d == 0) { | |
ep = 0; | |
} | |
else { | |
x = doubleToLongBits(d); | |
ep = toInt(and(shr(x, 52), P7ff_longLit)) - 1022; | |
x = and(x, N7ff0000000000001_longLit); | |
x = or(x, P3fe0000000000000_longLit); | |
frexp = longBitsToDouble(x); | |
} | |
return initValues(_3D_classLit, {}, -1, [frexp, ep]); | |
} | |
function ldexp(d, e){ | |
var x; | |
if (isNaN(d)) | |
return d; | |
if (d == 0 || !isFinite(d)) | |
return d; | |
if (isNaN(e)) | |
return e; | |
if (d == 0) { | |
return 0; | |
} | |
x = doubleToLongBits(d); | |
e = e + (toInt(shr(x, 52)) & 2047); | |
if (e <= 0) { | |
return 0; | |
} | |
if (e >= 2047) { | |
if (d < 0) { | |
return -Infinity; | |
} | |
return Infinity; | |
} | |
x = and(x, N7ff0000000000001_longLit); | |
x = or(x, shl(fromInt(e), 52)); | |
return longBitsToDouble(x); | |
} | |
function $clinit_38(){ | |
$clinit_38 = nullMethod; | |
MAX_MANTISSA_VALUE = Math.pow(2, 52); | |
} | |
function doubleToLongBits(value){ | |
$clinit_38(); | |
var absV, exp, exponent, guess, mantissa, result, sign; | |
sign = value < 0?N8000000000000000_longLit:P0_longLit; | |
absV = value <= 0?0 - value:value; | |
if (isNaN(value)) { | |
return P7ff8000000000000_longLit; | |
} | |
if (!isFinite(value)) { | |
exponent = P7ff0000000000000_longLit; | |
} | |
else { | |
if (absV == 0) { | |
exponent = P0_longLit; | |
} | |
else { | |
guess = round_int(floor(Math.log(absV) / Math.log(2))); | |
guess = -1023 > (guess < 1023?guess:1023)?-1023:guess < 1023?guess:1023; | |
exp = Math.pow(2, guess); | |
absV = absV / exp; | |
while (absV > 2) { | |
++guess; | |
absV /= 2; | |
} | |
while (absV < 1 && guess > 0) { | |
--guess; | |
absV *= 2; | |
} | |
exponent = shl(add(fromInt(guess), P3ff_longLit), 52); | |
} | |
} | |
lte(exponent, P3ff_longLit) && (absV /= 2); | |
mantissa = fromDouble(absV % 1 * MAX_MANTISSA_VALUE); | |
result = or(create0(sign.l | exponent.l, sign.m | exponent.m, sign.h | exponent.h), and(mantissa, Pfffffffffffff_longLit)); | |
return result; | |
} | |
function longBitsToDouble(bits){ | |
$clinit_38(); | |
var denorm, exponent, mantissa, sign; | |
exponent = toInt(shr(and(bits, P7ff0000000000000_longLit), 52)); | |
denorm = exponent == 0?1:0; | |
exponent = exponent - 1023 + denorm; | |
mantissa = and(bits, Pfffffffffffff_longLit); | |
sign = neq(and(bits, N8000000000000000_longLit), P0_longLit)?-1:1; | |
if (exponent == 1024) { | |
return neq(mantissa, P0_longLit)?NaN:sign < 0?-Infinity:Infinity; | |
} | |
return sign * (toDouble(mantissa) / MAX_MANTISSA_VALUE + (1 - denorm)) * Math.pow(2, exponent); | |
} | |
var MAX_MANTISSA_VALUE; | |
var $entry = entry; | |
function gwtOnLoad(errFn, modName, modBase, softPermutationId){ | |
$moduleName = modName; | |
$moduleBase = modBase; | |
if (errFn) | |
try { | |
$entry(init)(); | |
} | |
catch (e) { | |
errFn(modName); | |
} | |
else { | |
$entry(init)(); | |
} | |
} | |
var _3Ljava_lang_StackTraceElement_2_classLit = new Class_0, _3Lcom_google_gwt_lang_LongLibBase$LongEmul_2_classLit = new Class_0, _3D_classLit = new Class_0; | |
if (waqas_MattyMath) waqas_MattyMath.onScriptLoad(gwtOnLoad);})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment