<commit_before>//
//  Misc.swift
//  Collections
//
//  Created by <NAME> on 20/02/2016.
//  Copyright © 2016 <NAME>. All rights reserved.
//

/// Returns `true` if `value` is a power of 2.
@warn_unused_result
public func isPowerOfTwo<T : IntegerType>(value: T) -> Bool {
  return value > 0 && (value & (value &- 1)) == 0
}

/// Returns the `value` nearest power of 2.
@warn_unused_result
public func nearestPowerOfTwo<T : IntegerType>(value: T) -> T {
  var v: T = 1
  while (v < value) {
    v *= 2
  }
  return v
}<commit_msg>[Docs] Fix minor typo.<commit_after>//
//  Misc.swift
//  Collections
//
//  Created by <NAME> on 20/02/2016.
//  Copyright © 2016 <NAME>. All rights reserved.
//

/// Returns `true` if `value` is a power of 2.
@warn_unused_result
public func isPowerOfTwo<T : IntegerType>(value: T) -> Bool {
  return value > 0 && (value & (value &- 1)) == 0
}

/// Returns the `value`s nearest power of 2.
@warn_unused_result
public func nearestPowerOfTwo<T : IntegerType>(value: T) -> T {
  var v: T = 1
  while (v < value) {
    v *= 2
  }
  return v
}
{'fraction_non_alphanumeric': 0.16198501872659177, 'fraction_numerical': 0.035580524344569285, 'mean_word_length': 2.777385159010601, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, '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': '3356167', 'n_tokens_mistral': 421, 'n_tokens_neox': 384, 'n_words': 129}