From "Mastering Perl / Chapter 16 / Bit Operators / Unary NOT, ~":
The unary NOT operator (sometimes called the complement operator), ~, returns a bitwise negation or 1 addition to the value based on the integer size of the architecture
Why are two different values displayed in the following script?
#!/usr/local/bin/perl use warnings; use 5.012; use Config; my $int_size = $Config{intsize} * 8; my $value = 0b1111_1111; my $complement = ~ $value; say length sprintf "%${int_size}b", $value; say length sprintf "%${int_size}b", $complement;
Conclusion:
32 64
The key phrase is "based on the integer size of the architecture." You use this in a 64-bit architecture, so the complement will be returned as a 64-bit integer. Running code on a 32-bit architecture gives output 32 32.
32 32
Devel::Peek::Dump, , $complement , $value . , 32 , . , " , C " long ", int, ( GCC) 32- int 64- .
Devel::Peek::Dump
$complement
$value
intsize C 'int', " " , Perl , , . $Config{'ivsize'} ( uvsize; ), , ( ivtype/uvtype, , C).
$Config{'ivsize'}
, intsize 4, ivsize 8. %32b, 32; $value 8 , 32, $supplement 64 .
%32b
Source: https://habr.com/ru/post/1782891/More articles:Не удалось обработать UIInterfaceOrientationPortraitUpsideDown для просмотра Контроллер для iPad - ipadHow to access controls in a Gridview template with a user id - asp.netDoes the flow of context not display the correct output? - phpWill Linux hinder stack and heap growth in each other? - c ++Screenshot of a specific area in C #? - c #Common lisp, CFFI and instantiation c structs - chttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1782893/weird-problem-with-androidjava-method-control-seems-to-jump-across-ifelse-block&usg=ALkJrhg02njPC6Rho--O_poWxu4mjc0t9AСамый простой способ литья Список to List - collectionsAnimation of different images in a list - androidiPhone: Can I take samples from the garage range and use them in my application? - iphoneAll Articles