Comparing version 0.0.12 to 0.0.13
@@ -0,0 +0,0 @@ import { Pair } from "../utility/Pair"; |
@@ -0,0 +0,0 @@ import { advance, distance } from "../iterator/global"; |
@@ -0,0 +0,0 @@ export * from "./binary_search"; |
@@ -0,0 +0,0 @@ import { Pair } from "../utility/Pair"; |
@@ -0,0 +0,0 @@ import { Pair } from "../utility/Pair"; |
@@ -0,0 +0,0 @@ import { Vector } from "../container/Vector"; |
@@ -0,0 +0,0 @@ import { advance } from "../iterator/global"; |
@@ -0,0 +0,0 @@ import { Pair } from "../utility/Pair"; |
@@ -0,0 +0,0 @@ import { Vector } from "../container/Vector"; |
@@ -0,0 +0,0 @@ import { Vector } from "../container/Vector"; |
@@ -0,0 +0,0 @@ # Contributor Covenant Code of Conduct |
@@ -8,3 +8,2 @@ import { Vector } from "./Vector"; | ||
import { IForwardIterator } from "../iterator/IForwardIterator"; | ||
import { Repeater } from "../internal/iterator/disposable/Repeater"; | ||
@@ -26,6 +25,6 @@ import { distance } from "../iterator/global"; | ||
this.matrix_.push_back(new Vector()); | ||
this.matrix_.back().reserve(Deque.MIN_ROW_CAPACITY); | ||
this.matrix_.back().reserve(MIN_ROW_CAPACITY); | ||
this.size_ = 0; | ||
this.capacity_ = Deque.ROW_SIZE * Deque.MIN_ROW_CAPACITY; | ||
this.capacity_ = ROW_SIZE * MIN_ROW_CAPACITY; | ||
} | ||
@@ -54,3 +53,3 @@ | ||
this.matrix_.push_back(new Vector()); | ||
this.matrix_.back().reserve(Deque.MIN_ROW_CAPACITY); | ||
this.matrix_.back().reserve(MIN_ROW_CAPACITY); | ||
@@ -68,12 +67,19 @@ this.size_ = 0; | ||
@inline | ||
public reserve(capacity: usize): void | ||
{ | ||
if (this.capacity_ < CMath.max(capacity, ROW_SIZE * MIN_ROW_CAPACITY)) | ||
this._Reserve(capacity, this.size()); | ||
} | ||
private _Reserve(capacity: usize, limit: usize): void | ||
{ | ||
// FIX CAPACITY | ||
capacity = CMath.max(capacity, Deque.ROW_SIZE * Deque.MIN_ROW_CAPACITY); | ||
capacity = CMath.max(capacity, ROW_SIZE * MIN_ROW_CAPACITY); | ||
const length: usize = this._Compute_row_size(capacity); | ||
capacity = length * Deque.ROW_SIZE; | ||
capacity = length * ROW_SIZE; | ||
// CREATE THE NEW MATRIX | ||
const matrix: Vector<Vector<T>> = new Vector(); | ||
matrix.reserve(Deque.ROW_SIZE); | ||
matrix.reserve(ROW_SIZE); | ||
this._Insert_row(matrix.end(), length); | ||
@@ -90,8 +96,2 @@ | ||
@inline | ||
public static reserve<T>(deque: Deque<T>, capacity: usize): void | ||
{ | ||
deque._Reserve(capacity, deque.size()); | ||
} | ||
private _Try_expand(plus: usize, limit: usize = this.size()): void | ||
@@ -103,3 +103,3 @@ { | ||
const capacity: usize = CMath.max(required, this.capacity() * 2); | ||
const capacity: usize = CMath.max(required, this.capacity() * MAGNIFIER); | ||
this._Reserve(capacity, limit); | ||
@@ -136,3 +136,3 @@ } | ||
{ | ||
const value: f64 = capacity / <f64>Deque.ROW_SIZE; | ||
const value: f64 = capacity / <f64>ROW_SIZE; | ||
const ret: usize = <usize>Math.ceil(value); | ||
@@ -247,3 +247,3 @@ | ||
// ADD A NEW ROW IF REQUIRED | ||
if (top.size() >= length && this.matrix_.size() < Deque.ROW_SIZE) | ||
if (top.size() >= length && this.matrix_.size() < ROW_SIZE) | ||
top = this._Insert_row(this.matrix_.begin(), length); | ||
@@ -265,3 +265,3 @@ | ||
// ADD A NEW ROW IF REQUIRED | ||
if (bottom.size() >= length && this.matrix_.size() < Deque.ROW_SIZE) | ||
if (bottom.size() >= length && this.matrix_.size() < ROW_SIZE) | ||
bottom = this._Insert_row(this.matrix_.end(), length); | ||
@@ -312,3 +312,3 @@ | ||
const deque: Deque<T> = new Deque(); | ||
deque._Reserve(CMath.max(this.size() + plus, this.capacity() * 2), 0); | ||
deque._Reserve(CMath.max(this.size() + plus, this.capacity() * MAGNIFIER), 0); | ||
@@ -452,6 +452,2 @@ deque.insert_range(deque.end(), this.begin(), pos); | ||
{ | ||
export const ROW_SIZE: usize = 8; | ||
export const MIN_ROW_CAPACITY: usize = 4; | ||
export const MAGNIFIER: usize = 2; | ||
export class Iterator<T> | ||
@@ -630,2 +626,6 @@ { | ||
} | ||
} | ||
} | ||
@inline const ROW_SIZE: usize = 8; | ||
@inline const MIN_ROW_CAPACITY: usize = 4; | ||
@inline const MAGNIFIER: usize = 2; |
@@ -0,0 +0,0 @@ import { IForwardIterator } from "../iterator/IForwardIterator"; |
@@ -0,0 +0,0 @@ import { MapElementList } from "../internal/container/associative/MapElementList"; |
@@ -0,0 +0,0 @@ import { MapElementList } from "../internal/container/associative/MapElementList"; |
@@ -0,0 +0,0 @@ import { SetElementList } from "../internal/container/associative/SetElementList"; |
@@ -0,0 +0,0 @@ import { SetElementList } from "../internal/container/associative/SetElementList"; |
@@ -0,0 +0,0 @@ export * from "./Deque"; |
@@ -0,0 +0,0 @@ import { IForwardIterator } from "../iterator/IForwardIterator"; |
@@ -0,0 +0,0 @@ import { Vector } from "./Vector"; |
@@ -0,0 +0,0 @@ import { List } from "./List"; |
@@ -0,0 +0,0 @@ import { Vector } from "./Vector"; |
@@ -0,0 +0,0 @@ import { MapElementList } from "../internal/container/associative/MapElementList"; |
@@ -0,0 +0,0 @@ import { MapElementList } from "../internal/container/associative/MapElementList"; |
@@ -0,0 +0,0 @@ import { SetElementList } from "../internal/container/associative/SetElementList"; |
@@ -0,0 +0,0 @@ import { SetElementList } from "../internal/container/associative/SetElementList"; |
@@ -0,0 +0,0 @@ import { VectorContainer } from "../internal/container/linear/VectorContainer"; |
@@ -0,0 +0,0 @@ import { TreeMap } from "./TreeMap"; |
@@ -0,0 +0,0 @@ import { LogicError } from "./LogicError"; |
@@ -0,0 +0,0 @@ export class Exception extends Error |
@@ -0,0 +0,0 @@ export * from "./DomainError"; |
@@ -0,0 +0,0 @@ import { LogicError } from "./LogicError"; |
@@ -0,0 +0,0 @@ import { LogicError } from "./LogicError"; |
@@ -0,0 +0,0 @@ import { Exception } from "./Exception"; |
@@ -0,0 +0,0 @@ import { LogicError } from "./LogicError"; |
@@ -0,0 +0,0 @@ import { RuntimeError } from "./RuntimeError"; |
@@ -0,0 +0,0 @@ import { RuntimeError } from "./RuntimeError"; |
@@ -0,0 +0,0 @@ import { Exception } from "./Exception"; |
@@ -0,0 +0,0 @@ import { RuntimeError } from "./RuntimeError"; |
@@ -0,0 +0,0 @@ import { MapElementVector } from "../../internal/container/associative/MapElementVector"; |
@@ -0,0 +0,0 @@ import { MapElementVector } from "../../internal/container/associative/MapElementVector"; |
@@ -0,0 +0,0 @@ import { SetElementVector } from "../../internal/container/associative/SetElementVector"; |
@@ -0,0 +0,0 @@ import { SetElementVector } from "../../internal/container/associative/SetElementVector"; |
@@ -0,0 +0,0 @@ export * from "./FlatMap"; |
@@ -0,0 +0,0 @@ import * as experimental from "./module"; |
@@ -0,0 +0,0 @@ @inline |
@@ -1,20 +0,25 @@ | ||
export function hash<T>(obj: T): usize | ||
export function hash<T>(key: T): usize | ||
{ | ||
if (isInteger(obj) || isFloat(obj) || isBoolean(obj)) | ||
return hash_by_string(obj); | ||
else if (isString(obj)) | ||
return hash_string(<string>obj); | ||
else if (isReference(obj)) | ||
return hash_by_string(changetype<usize>(obj)); | ||
if (isString<T>()) | ||
return hash_string(key); | ||
else if (isReference<T>()) | ||
{ | ||
if (sizeof<T>() === 4) return hash32(<usize>changetype<u32>(key)); | ||
if (sizeof<T>() === 8) return hash64(<usize>changetype<u64>(key)); | ||
} | ||
else if (isFloat<T>()) | ||
{ | ||
if (sizeof<T>() === 4) return hash32(<usize>reinterpret<u32>(f32(key))); | ||
if (sizeof<T>() === 8) return hash64(<usize>reinterpret<u64>(f64(key))); | ||
} | ||
else | ||
return 0; | ||
{ | ||
if (sizeof<T>() === 1) return hash8(usize(key)); | ||
if (sizeof<T>() === 2) return hash16(usize(key)); | ||
if (sizeof<T>() === 4) return hash32(usize(key)); | ||
if (sizeof<T>() === 8) return hash64(usize(key)); | ||
} | ||
return 0; | ||
} | ||
@inline | ||
function hash_by_string<T extends IStringable> | ||
(value: T): usize | ||
{ | ||
return hash_string(value.toString()); | ||
} | ||
function hash_string(str: string): usize | ||
@@ -31,8 +36,47 @@ { | ||
const INIT_VALUE: usize = 2166136261; | ||
const MULTIPLIER: usize = 16777619; | ||
function hash8(key: usize): usize | ||
{ | ||
return INIT_VALUE ^ key * MULTIPLIER; | ||
} | ||
interface IStringable | ||
function hash16(key: usize): usize | ||
{ | ||
toString(): string; | ||
} | ||
let ret: usize = INIT_VALUE; | ||
ret = (ret ^ ( key & 0xff)) * MULTIPLIER; | ||
ret = (ret ^ ( key >> 8 )) * MULTIPLIER; | ||
return ret; | ||
} | ||
function hash32(key: usize): usize | ||
{ | ||
let ret: usize = INIT_VALUE; | ||
ret = (ret ^ ( key & 0xff)) * MULTIPLIER; | ||
ret = (ret ^ ((key >> 8) & 0xff)) * MULTIPLIER; | ||
ret = (ret ^ ((key >> 16) & 0xff)) * MULTIPLIER; | ||
ret = (ret ^ ( key >> 24 )) * MULTIPLIER; | ||
return ret; | ||
} | ||
function hash64(key: usize): usize | ||
{ | ||
// SEPARATE FOR 32 BITS SYSTEM | ||
const x: usize = key; | ||
const y: usize = (key >>> 32); | ||
var ret = INIT_VALUE; | ||
ret = (ret ^ ( x & 0xff)) * MULTIPLIER; | ||
ret = (ret ^ ((x >> 8) & 0xff)) * MULTIPLIER; | ||
ret = (ret ^ ((x >> 16) & 0xff)) * MULTIPLIER; | ||
ret = (ret ^ ( x >> 24 )) * MULTIPLIER; | ||
ret = (ret ^ ( y & 0xff)) * MULTIPLIER; | ||
ret = (ret ^ ((y >> 8) & 0xff)) * MULTIPLIER; | ||
ret = (ret ^ ((y >> 16) & 0xff)) * MULTIPLIER; | ||
ret = (ret ^ ( y >> 24 )) * MULTIPLIER; | ||
return ret; | ||
} | ||
@inline const INIT_VALUE: usize = 2166136261; | ||
@inline const MULTIPLIER: usize = 16777619; |
export * from "./comparators"; | ||
export * from "./hash"; | ||
export * from "./IPointer"; |
@@ -0,0 +0,0 @@ export interface IPointer<T> |
@@ -0,0 +0,0 @@ import * as std from "./module"; |
@@ -0,0 +0,0 @@ import { IContainer, IContainerIterator, IContainerReverseIterator } from "../linear/IContainer"; |
@@ -0,0 +0,0 @@ import { IContainer, IContainerIterator, IContainerReverseIterator } from "../linear/IContainer"; |
@@ -0,0 +0,0 @@ import { IMapContainer } from "./IMapContainer"; |
@@ -0,0 +0,0 @@ import { ISetContainer } from "./ISetContainer"; |
@@ -0,0 +0,0 @@ import { IContainer, IContainerIterator, IContainerReverseIterator } from "../linear/IContainer"; |
@@ -0,0 +0,0 @@ import { IContainer, IContainerIterator, IContainerReverseIterator } from "../linear/IContainer"; |
@@ -0,0 +0,0 @@ import { IContainer, IContainerIterator, IContainerReverseIterator } from "../linear/IContainer"; |
@@ -0,0 +0,0 @@ import { IMapContainer, IMapContainerIterator, IMapContainerReverseIterator } from "./IMapContainer"; |
@@ -0,0 +0,0 @@ import { ISetContainer, ISetContainerIterator, ISetContainerReverseIterator } from "./ISetContainer"; |
@@ -0,0 +0,0 @@ import { IMapContainer } from "./IMapContainer"; |
@@ -0,0 +0,0 @@ import { ITreeMap } from "./ITreeMap"; |
@@ -0,0 +0,0 @@ import { ISetContainer } from "./ISetContainer"; |
@@ -0,0 +0,0 @@ import { ITreeSet } from "./ITreeSet"; |
@@ -0,0 +0,0 @@ import { IContainer } from "./IContainer"; |
@@ -0,0 +0,0 @@ import { IReversableIterator } from "../../../iterator/IReversableIterator"; |
@@ -0,0 +0,0 @@ import { IContainer, IContainerIterator, IContainerReverseIterator } from "./IContainer"; |
@@ -0,0 +0,0 @@ import { distance } from "../../../iterator/global"; |
@@ -0,0 +0,0 @@ export declare interface IClear |
@@ -0,0 +0,0 @@ import { IPushFront } from "./IPushFront"; |
@@ -0,0 +0,0 @@ export declare interface IEmpty |
@@ -0,0 +0,0 @@ export declare interface IFront<T> |
@@ -0,0 +0,0 @@ import { IPointer } from "../../../functional/IPointer"; |
@@ -0,0 +0,0 @@ export declare interface IPushBack<T> |
@@ -0,0 +0,0 @@ export declare interface IPushFront<T> |
@@ -0,0 +0,0 @@ export declare interface ISize |
@@ -0,0 +0,0 @@ import { OutOfRange } from "../../exception/OutOfRange"; |
@@ -0,0 +0,0 @@ export class SourcePointer<T extends object> |
@@ -70,3 +70,3 @@ import { Vector } from "../../container/Vector"; | ||
{ | ||
length = length / this.max_load_factor_; | ||
length = <usize>(length / this.max_load_factor_); | ||
this.rehash(length); | ||
@@ -73,0 +73,0 @@ } |
@@ -0,0 +0,0 @@ import { HashBuckets } from "./HashBuckets"; |
@@ -0,0 +0,0 @@ export class Repeater<T> |
@@ -0,0 +0,0 @@ import { IContainer, IContainerIterator, IContainerReverseIterator } from "../container/linear/IContainer"; |
@@ -0,0 +0,0 @@ import { Vector } from "../../container/Vector"; |
@@ -0,0 +0,0 @@ import { MultiXTree } from "./MultiXTree"; |
@@ -116,2 +116,3 @@ import { XTreeNode } from "./XTreeNode"; | ||
// RETURNS -> MATCHED OR NOT | ||
// return matched !== null ? matched : ret; | ||
if (matched !== null) | ||
@@ -118,0 +119,0 @@ return matched; |
@@ -0,0 +0,0 @@ import { UniqueXTree } from "./UniqueXTree"; |
@@ -0,0 +0,0 @@ import { XTreeNode } from "./XTreeNode"; |
@@ -0,0 +0,0 @@ export const enum XColor |
@@ -0,0 +0,0 @@ import { XColor } from "./XColor"; |
@@ -0,0 +0,0 @@ import { IPushBack } from "../internal/container/partial/IPushBack"; |
@@ -0,0 +0,0 @@ import { IPushBack } from "../internal/container/partial/IPushBack"; |
@@ -0,0 +0,0 @@ import { IPushFront } from "../internal/container/partial/IPushFront"; |
@@ -0,0 +0,0 @@ import { IEmpty } from "../internal/container/partial/IEmpty"; |
@@ -0,0 +0,0 @@ import { IForwardIterator } from "./IForwardIterator"; |
@@ -0,0 +0,0 @@ import { IPointer } from "../functional/IPointer"; |
@@ -0,0 +0,0 @@ export * from "./IBidirectionalIterator"; |
@@ -0,0 +0,0 @@ export class InsertIterator<ContainerT, IteratorT, T> |
@@ -0,0 +0,0 @@ import { IBidirectionalIterator } from "./IBidirectionalIterator"; |
@@ -0,0 +0,0 @@ import { IBidirectionalIterator } from "./IBidirectionalIterator"; |
@@ -0,0 +0,0 @@ import { IBidirectionalIterator } from "./IBidirectionalIterator"; |
@@ -0,0 +0,0 @@ export * from "./algorithm"; |
@@ -0,0 +0,0 @@ export * from "./special_math"; |
@@ -0,0 +0,0 @@ import { BinaryPredicator } from "../internal/functional/BinaryPredicator"; |
@@ -0,0 +0,0 @@ /* --------------------------------------------------------- |
@@ -0,0 +0,0 @@ import { InvalidArgument } from "../../exception/InvalidArgument"; |
@@ -0,0 +0,0 @@ import { tgamma } from "./gamma"; |
@@ -0,0 +0,0 @@ import { InvalidArgument } from "../../exception/InvalidArgument"; |
@@ -0,0 +0,0 @@ import { CMath } from "../../internal/numeric/CMath"; |
@@ -0,0 +0,0 @@ export function tgamma(x: f64): f64 |
@@ -0,0 +0,0 @@ import { Vector } from "../../container/Vector"; |
@@ -0,0 +0,0 @@ export * from "./bessels"; |
@@ -0,0 +0,0 @@ import { Vector } from "../../container/Vector"; |
@@ -0,0 +0,0 @@ import { Vector } from "../../container/Vector"; |
@@ -45,2 +45,2 @@ import { tgamma } from "./gamma"; | ||
const INFINITY: usize = 100 * 1000; | ||
@inline const INFINITY: usize = 100 * 1000; |
@@ -9,3 +9,3 @@ { | ||
}, | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"ascMain": "./index.ts", | ||
@@ -12,0 +12,0 @@ "scripts": { |
@@ -0,0 +0,0 @@ import { IForwardContainer } from "./IForwardContainer"; |
@@ -0,0 +0,0 @@ import { IPointer } from "../../functional/IPointer"; |
@@ -0,0 +0,0 @@ import { IForwardContainer } from "./IForwardContainer"; |
@@ -0,0 +0,0 @@ # AssemblyScript Standard Template Library |
@@ -0,0 +0,0 @@ export class Entry<Key, T> |
export * from "./IPair"; | ||
export * from "./Pair"; | ||
export * from "./Entry"; |
@@ -0,0 +0,0 @@ export interface IPair<First, Second> |
@@ -0,0 +0,0 @@ export class Pair<First, Second> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
342134
9585