<commit_before>//
//  Types.swift
//  PtahRenderer
//
//  Created by <NAME> on 13/02/2016.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation

typealias Scalar = Float
typealias Color = (UInt8, UInt8, UInt8)



/*-- Color---------*/

func *(lhs: Scalar, rhs: Color) -> Color {
	return (UInt8(lhs*Scalar(rhs.0)), UInt8(lhs*Scalar(rhs.1)), UInt8(lhs*Scalar(rhs.2)))
}

func *(rhs: Color, lhs: Scalar) -> Color {
	return lhs*rhs
}

func /(lhs: Color, rhs: Scalar) -> Color {
	return (UInt8(Scalar(lhs.0)/rhs), UInt8(Scalar(lhs.1)/rhs), UInt8(Scalar(lhs.2)/rhs))
}


<commit_msg>Correct computations for Color elements.<commit_after>//
//  Types.swift
//  PtahRenderer
//
//  Created by <NAME> on 13/02/2016.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation

typealias Scalar = Float
typealias Color = (UInt8, UInt8, UInt8)



/*-- Color---------*/

func *(lhs: Scalar, rhs: Color) -> Color {
	let r = clamp(lhs*Scalar(rhs.0),0,255)
	let g = clamp(lhs*Scalar(rhs.1),0,255)
	let b = clamp(lhs*Scalar(rhs.2),0,255)
	return (UInt8(r), UInt8(g), UInt8(b))
}

func *(rhs: Color, lhs: Scalar) -> Color {
	return lhs*rhs
}

func /(lhs: Color, rhs: Scalar) -> Color {
	return (UInt8(Scalar(lhs.0)/rhs), UInt8(Scalar(lhs.1)/rhs), UInt8(Scalar(lhs.2)/rhs))
}

func +(rhs: Color, lhs: Color) -> Color {
	let r = clamp(Scalar(rhs.0)+Scalar(lhs.0),0,255)
	let g = clamp(Scalar(rhs.1)+Scalar(lhs.1),0,255)
	let b = clamp(Scalar(rhs.2)+Scalar(lhs.2),0,255)
	return (UInt8(r), UInt8(g), UInt8(b))
}



{'fraction_non_alphanumeric': 0.2098360655737705, 'fraction_numerical': 0.057049180327868855, 'mean_word_length': 3.652439024390244, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, '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': '6403229', 'n_tokens_mistral': 686, 'n_tokens_neox': 654, 'n_words': 140}