- parzystość liczby
x & 1
- sprawdzenie czy dwa int-y mają przeciwny znak
(x ^ y) < 0
- dodanie 1 do int-a
-~x
- swap
x = x ^ y; // x^= y;
y = x ^ y;
x = x ^ y;
- wyłączenie k-tego bitu
x & (~(1 << (k - 1)))
x & 1
(x ^ y) < 0
-~x
x = x ^ y; // x^= y;
y = x ^ y;
x = x ^ y;
x & (~(1 << (k - 1)))
fn main() {
let s1 = String::from("hello");
let (s2, len) = calculate_length(s1);
println!("The length of '{}' is {}.", s2, len);
}
fn calculate_length(s: String) -> (String, usize) {
let length = s.len(); // len() returns the length of a String
function rgbToLab( R, G, B ) { | |
R = ( R / 255 ); | |
G = ( G / 255 ); | |
B = ( B / 255 ); | |
if ( R > 0.04045 ) R = Math.pow( ( R + 0.055 ) / 1.055, 2.4 ); | |
else R = R / 12.92; | |
if ( G > 0.04045 ) G = Math.pow( ( G + 0.055 ) / 1.055, 2.4 ); | |
else G = G / 12.92; | |
if ( B > 0.04045 ) B = Math.pow( ( B + 0.055 ) / 1.055, 2.4 ); |
People
![]() :bowtie: |
😄 :smile: |
😆 :laughing: |
---|---|---|
😊 :blush: |
😃 :smiley: |
:relaxed: |
😏 :smirk: |
😍 :heart_eyes: |
😘 :kissing_heart: |
😚 :kissing_closed_eyes: |
😳 :flushed: |
😌 :relieved: |
😆 :satisfied: |
😁 :grin: |
😉 :wink: |
😜 :stuck_out_tongue_winking_eye: |
😝 :stuck_out_tongue_closed_eyes: |
😀 :grinning: |
😗 :kissing: |
😙 :kissing_smiling_eyes: |
😛 :stuck_out_tongue: |
FWIW: I didn't produce the content present here. I've just copy-pasted it from somewhere over the Internet, but I cannot remember exactly the original source. I was also not able to find the author's name, so I cannot give him/her the proper credit.