<commit_before>#pragma once
// bitset_helpers.hpp: definitions of bitset operators and helpers
//
// Copyright (C) 2017 Stillwater Supercomputing, Inc.
//
// This file is part of the universal numbers project, which is released under an MIT Open Source license.

// number representation is sign-magnitude, sign is msb

namespace sw {
	namespace unum {
		template<size_t sign_magnitude>
		std::bitset<sign_magnitude> ones_complement(std::bitset<sign_magnitude> number) {
			std::bitset<sign_magnitude> complement;
			for (size_t i = 0; i < sign_magnitude; i++) {
				complement.set(i, !number[i]);
			}
			return complement;
		}


		template<size_t nbits>
		std::bitset<nbits> twos_complement(std::bitset<nbits> number) {
			std::bitset<nbits> complement;
			uint8_t _slice = 0;
			uint8_t carry = 1;
			for (size_t i = 0; i < nbits; i++) {
				_slice = uint8_t(!number[i]) + carry;
				carry = _slice >> 1;
				complement[i] = (0x1 & _slice);
			}
			return complement;
		}

		// DANGER: this depends on the implicit type conversion of number to a uint64_t to sign extent a 2's complement number system
		// if nbits > 64 then this code breaks.
		template<size_t nbits, class Type><commit_msg>Build: Fix compile errors due to missing header includes.<commit_after>#pragma once
// bitset_helpers.hpp: definitions of bitset operators and helpers
//
// Copyright (C) 2017 Stillwater Supercomputing, Inc.
//
// This file is part of the universal numbers project, which is released under an MIT Open Source license.

// number representation is sign-magnitude, sign is msb

#include <bitset>
#include <sstream>


namespace sw {
	namespace unum {
		template<size_t sign_magnitude>
		std::bitset<sign_magnitude> ones_complement(std::bitset<sign_magnitude> number) {
			std::bitset<sign_magnitude> complement;
			for (size_t i = 0; i < sign_magnitude; i++) {
				complement.set(i, !number[i]);
			}
			return complement;
		}


		template<size_t nbits>
		std::bitset<nbits> twos_complement(std::bitset<nbits> number) {
			std::bitset<nbits> complement;
			uint8_t _slice = 0;
			uint8_t carry = 1;
			for (size_t i = 0; i < nbits; i++) {
				_slice = uint8_t(!number[i]) + carry;
				carry = _slice >> 1;
				complement[i] = (0x1 & _slice);
			}
			return complement;
		}

		// DANGER: this depends on the implicit type conversion of number to a uint64_t to sign extent a 2's complement number system
		// if nbits > 64 then this code breaks.
		template<size_t nbits, class Type>
{'fraction_non_alphanumeric': 0.1084581141238365, 'fraction_numerical': 0.01537838931606637, 'mean_word_length': 3.847058823529412, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, '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': '3187321', 'n_tokens_mistral': 947, 'n_tokens_neox': 821, 'n_words': 261}