MCPcopy Index your code
hub / github.com/gpujs/gpu.js / setupConstants

Method setupConstants

src/backend/kernel.js:400–425  ·  view source on GitHub ↗

* Setup constants

()

Source from the content-addressed store, hash-verified

398 * Setup constants
399 */
400 setupConstants() {
401 this.kernelConstants = [];
402 let needsConstantTypes = this.constantTypes === null;
403 if (needsConstantTypes) {
404 this.constantTypes = {};
405 }
406 this.constantBitRatios = {};
407 if (this.constants) {
408 for (let name in this.constants) {
409 if (needsConstantTypes) {
410 const type = utils.getVariableType(this.constants[name], this.strictIntegers);
411 this.constantTypes[name] = type;
412 this.kernelConstants.push({
413 name,
414 type
415 });
416 } else {
417 this.kernelConstants.push({
418 name,
419 type: this.constantTypes[name]
420 });
421 }
422 this.constantBitRatios[name] = this.getBitRatio(this.constants[name]);
423 }
424 }
425 }
426
427 /**
428 *

Callers 1

setupConstantsTestSuiteFunction · 0.45

Calls 2

getBitRatioMethod · 0.95
getVariableTypeMethod · 0.80

Tested by

no test coverage detected