2013-12-22 11:59:42 +01:00
|
|
|
/**
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* Xenia : Xbox 360 Emulator Research Project *
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* Copyright 2013 Ben Vanik. All rights reserved. *
|
|
|
|
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
|
|
|
|
******************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
var module = angular.module('xe.filters', []);
|
|
|
|
|
|
|
|
|
|
|
2013-12-25 07:08:44 +01:00
|
|
|
module.filter('hex16', function() {
|
|
|
|
|
return function(number) {
|
|
|
|
|
if (number !== null && number !== undefined) {
|
|
|
|
|
var str = '' + number.toString(16).toUpperCase();
|
|
|
|
|
while (str.length < 4) str = '0' + str;
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
2013-12-24 05:03:03 +01:00
|
|
|
module.filter('hex32', function() {
|
2013-12-22 11:59:42 +01:00
|
|
|
return function(number) {
|
|
|
|
|
if (number !== null && number !== undefined) {
|
2013-12-24 05:03:03 +01:00
|
|
|
var str = '' + number.toString(16).toUpperCase();
|
|
|
|
|
while (str.length < 8) str = '0' + str;
|
2013-12-22 11:59:42 +01:00
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|
2013-12-26 05:14:41 +01:00
|
|
|
|
|
|
|
|
module.filter('exp8', function() {
|
|
|
|
|
return function(number) {
|
|
|
|
|
if (number !== null && number !== undefined) {
|
|
|
|
|
var str = number.toExponential(8);
|
|
|
|
|
if (number >= 0) {
|
|
|
|
|
str = ' ' + str;
|
|
|
|
|
}
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|