[FLUG] Re: Ottimizziamo insieme

  • From: Simon <simon@xxxxxxxxx>
  • To: fanolug@xxxxxxxxxxxxx
  • Date: Thu, 28 Feb 2002 20:52:57 +0100

Mailing List del Fortunae LUG
=============================

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Feb 26, 2002 at 08:02:21PM +0100, Romano Romano wrote:
>
> Mi spiegheresti meglio cosa intendi per "shiftare a destra"?
> Ho letto, non troppo approfonditamente invero, il man di fstat ma non ho
> capito molto bene come funziona la faccenda...

Shift a destra = scorrimento a destra dei bit.

S_IRWXU    00700     mask for file owner permission
S_IRWXG    00070     mask for group permissions
S_IRWXO    00007     mask for permissions for others (not in group)

Come vedi S_IRWXO è ottenuto da uno shift a destra di 6 bit di S_IRWXU
e S_IRWXG è ottenuto con uno shift a destra di 3 bit da S_IRWXU.
(I permessi sono in formato ottale... per esprimere 8 combinazioni
servono 3 bit... ecco perchè lo shift "visuale" a destra del 7
corrisponde in realtà di uno shift a destra di 3 bit)

- -- 
/* Federico 's1m0n' Simoncelli <f.simon@xxxxxxxx>
   http://www.jkcal.org/simon
*/ 
int main(){unsigned int g,h=0;while(++h){for(g=(h>1)?2:1;g<
h/2+1&&h%g!=0;g++);if(g==h/2+1)printf("%i\n",h);}return 0;}

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8foqW/ItriIBKan0RAn6rAKDUclr27XhVJdjxIguw3aBwau+QSACaAlL+
mBMJHGn18FVQUN/k8AxqnoI=
=/jwz
-----END PGP SIGNATURE-----
--
http://perl.oreilly.com/news/success_stories.html

Other related posts: