<commit_before>import { enums } from './enums';

export default class IndexBuffer {
  /**
   * @constructor
   * @param {Device} device
   * @param {INDEX_FMT_*} format
   * @param {USAGE_*} usage
   * @param {ArrayBuffer} data
   * @param {Number} numIndices
   */
  constructor(device, format, usage, data, numIndices) {
    this._device = device;
    this._format = format;
    this._usage = usage;
    this._numIndices = numIndices;
    this._bytesPerIndex = 0;
    // calculate bytes
    let bytes = 0;
    if (format === enums.INDEX_FMT_UINT8) {
      this._bytesPerIndex = 1;
    } else if (format === enums.INDEX_FMT_UINT16) {
      this._bytesPerIndex = 2;
    } else if (format === enums.INDEX_FMT_UINT32) {
      this._bytesPerIndex = 4;
    }
    this._bytes = this._bytesPerIndex * numIndices;

    // update
    this._glID = device._gl.createBuffer();
    this.update(0, data);

    // stats<commit_msg>remove unused code<commit_after>import { enums } from './enums';

export default class IndexBuffer {
  /**
   * @constructor
   * @param {Device} device
   * @param {INDEX_FMT_*} format
   * @param {USAGE_*} usage
   * @param {ArrayBuffer} data
   * @param {Number} numIndices
   */
  constructor(device, format, usage, data, numIndices) {
    this._device = device;
    this._format = format;
    this._usage = usage;
    this._numIndices = numIndices;
    this._bytesPerIndex = 0;

    // calculate bytes
    if (format === enums.INDEX_FMT_UINT8) {
      this._bytesPerIndex = 1;
    } else if (format === enums.INDEX_FMT_UINT16) {
      this._bytesPerIndex = 2;
    } else if (format === enums.INDEX_FMT_UINT32) {
      this._bytesPerIndex = 4;
    }
    this._bytes = this._bytesPerIndex * numIndices;

    // update
    this._glID = device._gl.createBuffer();
    this.update(0, data);

    // stats
{'fraction_non_alphanumeric': 0.13069741900054915, 'fraction_numerical': 0.011532125205930808, 'mean_word_length': 2.7958333333333334, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5174205', 'n_tokens_mistral': 606, 'n_tokens_neox': 605, 'n_words': 138}