<commit_before>( function _fLong_s_() {

'use strict';

let _ArrayIndexOf = Array.prototype.indexOf;
let _ArrayIncludes = Array.prototype.includes;
if( !_ArrayIncludes )
_ArrayIncludes = function( e ){ _ArrayIndexOf.call( this, e ) }

let _global = _global_;
let _ = _global_.wTools;
let Self = _global_.wTools;

/*
               |  can grow   |  can shrink  |   range
grow                +                -         positive
select              -                +         positive
relength            +                +         positive
but                 -                +         negative
*/

/* array / long / buffer */
/* - / inplace */

// --
// arguments array
// --

function argumentsArrayMake( src )
{
  _.assert( arguments.length === 1 );
  _.assert( _.numberIs( src ) || _.longLike( src ) );
  if( _.numberIs( src ) )
  return _argumentsArrayMake.apply( _, Array( src ) );
  else
  return _argumentsArrayMake.apply( _, src );
}

//

function _argumentsArrayMake()
{
  return arguments;
}

//

function argumentsArrayFrom( src )
{
  _.assert( arguments.length === 1, 'Expects single argument' );
  if( _.argumentsArrayIs( src ) )
  return src;
  return _.argumentsArrayMake( src );
}

// --
// long
// --

/**
 * The routine longMake() returns a new Long with the same type as source Long (src). New Long makes from inserted Long (ins)
 * or if (ins) is number, the Long makes from (src) with length equal to (ins). If (ins) is not provided, routine returns copy of (src).
 *
 * @param { Long } src - Instance of Long or constructor, defines type of returned Long. If null is provided, routine returns empty array.
 * @param { Number|Long } ins - Defines length of new Long. If Long is provided, routine makes new Long from {-ins-} with {-src-} type.
 *
 * @example
 * _.longMake( null );
 * // returns []
 *
 * @example
 * _.longMake( [ 1, 2, 3, 4 ] );
 * // returns [ 1, 2, 3, 4 ];
 *
 * @example
 * let src = _.unrollMake( [] );
 * let got = _.longMake( src, [ 1, 2, 3 ] );
 * console.log( got );
 * // log [ 1, 2, 3 ];
 * console.log( _.unrollIs( got ) );
 * // log true
 *
 * @example
 * let src = new F32x( [ 1, 2, 3, 4, 5 ] );
 * let got = _.longMake( src, 2 );
 * console.log( got );
 * // log Float32Array[ 1, 2 ];
 * console.log( _.bufferTypedIs( got ) );
 * // log true
 *
 * @returns { Long } Returns a Long with type of source Long which makes from ins.
 * @function longMake
 * @throws { Error } If arguments.length is less than two or more then two.
 * @throws { Error } If {-ins-} is not a number and not a Long.
 * @throws { Error } If {-src-} is not a Long or not a constructor.
 * @throws { Error } If {-ins-} or ins.length has a not finite value.
 * @memberof wTools
 */

/*
qqq : extend coverage and documentation of longMake | Dmytro : extended coverage and documentation of routine longMake
qqq : longMake does not create unrolls, but should | Dmytro : longMake creates unrolls. Need to accept one from two variants.
*/

function longMake( src, ins )
{
  let result;
  let length = ins;

  if( _.longLike( length ) )
  length = length.length;

  if( length === undefined )
  {
    if( src === null )
    {
      length = 0;<commit_msg>Comments<commit_after>( function _fLong_s_() {

'use strict';

let _ArrayIndexOf = Array.prototype.indexOf;
let _ArrayIncludes = Array.prototype.includes;
if( !_ArrayIncludes )
_ArrayIncludes = function( e ){ _ArrayIndexOf.call( this, e ) }

let _global = _global_;
let _ = _global_.wTools;
let Self = _global_.wTools;

/*
               |  can grow   |  can shrink  |   range
grow                +                -         positive
select              -                +         positive
relength            +                +         positive
but                 -                +         negative
*/

/* array / long / buffer */
/* - / inplace */

// --
// arguments array
// --

function argumentsArrayMake( src )
{
  _.assert( arguments.length === 1 );
  _.assert( _.numberIs( src ) || _.longLike( src ) );
  if( _.numberIs( src ) )
  return _argumentsArrayMake.apply( _, Array( src ) );
  else
  return _argumentsArrayMake.apply( _, src );
}

//

function _argumentsArrayMake()
{
  return arguments;
}

//

function argumentsArrayFrom( src )
{
  _.assert( arguments.length === 1, 'Expects single argument' );
  if( _.argumentsArrayIs( src ) )
  return src;
  return _.argumentsArrayMake( src );
}

// --
// long
// --

/**
 * The routine longMake() returns a new Long with the same type as source Long (src). New Long makes from inserted Long (ins)
 * or if (ins) is number, the Long makes from (src) with length equal to (ins). If (ins) is not provided, routine returns copy of (src).
 *
 * @param { Long } src - Instance of Long or constructor, defines type of returned Long. If null is provided, routine returns empty array.
 * @param { Number|Long } ins - Defines length of new Long. If Long is provided, routine makes new Long from {-ins-} with {-src-} type.
 *
 * @example
 * _.longMake( null );
 * // returns []
 *
 * @example
 * _.longMake( [ 1, 2, 3, 4 ] );
 * // returns [ 1, 2, 3, 4 ];
 *
 * @example
 * let src = _.unrollMake( [] );
 * let got = _.longMake( src, [ 1, 2, 3 ] );
 * console.log( got );
 * // log [ 1, 2, 3 ];
 * console.log( _.unrollIs( got ) );
 * // log true
 *
 * @example
 * let src = new F32x( [ 1, 2, 3, 4, 5 ] );
 * let got = _.longMake( src, 2 );
 * console.log( got );
 * // log Float32Array[ 1, 2 ];
 * console.log( _.bufferTypedIs( got ) );
 * // log true
 *
 * @returns { Long } Returns a Long with type of source Long which makes from ins.
 * @function longMake
 * @throws { Error } If arguments.length is less than two or more then two.
 * @throws { Error } If {-ins-} is not a number and not a Long.
 * @throws { Error } If {-src-} is not a Long or not a constructor.
 * @throws { Error } If {-ins-} or ins.length has a not finite value.
 * @memberof wTools
 */

/* aaa : extend coverage and documentation of longMake */
/* Dmytro : extended coverage and documentation of routine longMake */
/* aaa : longMake does not create unrolls, but should */
/* Dmytro : longMake creates unrolls */

function longMake( src, ins )
{
  let result;
  let length = ins;

  if( _.longLike( length ) )
  length = length.length;

  if( length === undefined )
  {
    if( src === null )
    {
      length = 0;
{'fraction_non_alphanumeric': 0.13624841571609633, 'fraction_numerical': 0.009188846641318124, 'mean_word_length': 2.3940860215053763, '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': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2956011', 'n_tokens_mistral': 2040, 'n_tokens_neox': 1954, 'n_words': 718}