Sponsored Content
Full Discussion: Bitwise comparison of cols
Top Forums Shell Programming and Scripting Bitwise comparison of cols Post 302872669 by RudiC on Saturday 9th of November 2013 06:24:27 AM
Old 11-09-2013
Sheer curiosity: having the main loop run to NF-1 only might yield a fraction of a percent run time reduction:
Code:
{for(i=1; i<NF; i++) ...

Unfortunately, replacing the
Code:
 if($i==$j) c[i,j]++

by
Code:
 c[i,j]+= ($i==$j)

increases run time dramatically, probably because the ++ operation is a register operation while the other is a full addition.
 

10 More Discussions You Might Find Interesting

1. Programming

Bit-fields and Bitwise operators

Hi, Is it possible to use bitwise operators in bit fields? For example: typedef struct Mystruct { unsigned char A :1 ; unsigned char B :1 ; } Mystruct; and assume struct Mystruct STR_1S, STR_2S, tempSTRS = {0}; then the following line: tempSTRS = STR_1S & STR_2S; gives the... (3 Replies)
Discussion started by: amatsaka
3 Replies

2. UNIX for Advanced & Expert Users

bitwise operators

can anybody write a program to divide a number by another number using bitwise operators (9 Replies)
Discussion started by: areef4u
9 Replies

3. Programming

resetting counter using bitwise XOR

Hi ! How to reset a variable to 0 after a reset value, say 10 using bitwise XOR. For example, int cnt=0; if(cnt<10) cnt++; else cnt = 0; How can we achieve this by using XOR only. thanks, (1 Reply)
Discussion started by: mrgubbala
1 Replies

4. Shell Programming and Scripting

Bitwise negation

I am taking an online course on Unix scripting. The topic is Unix arithmetic operators and the lesson is Logical and bitwise operations. It is not clear how much storage space Unix uses to represent integers that are typed. Bitwise negation caused me to question how many bits are used to... (3 Replies)
Discussion started by: dLloydm
3 Replies

5. Programming

bitwise and if

Hi Suppose we have these code lines: #define _IN_USE 0x001 /* set when process slot is in use */ #define _EXITING 0x002 /* set when exit is expected */ #define _REFRESHING 0x004 ... 1 main () { 2 3 unsigned r_flags =_REFRESHING; 4 5 if (r_flag &... (3 Replies)
Discussion started by: Puntino
3 Replies

6. Shell Programming and Scripting

Grouping matches by cols

Dear all I have a large file w. ~ 10 million lines. The first two cols have matching partners. For example: A A A B B B or A A B A B B The matches may be separated by an unknown number of lines. My intention is to group them and add a "group" value in the last col. For... (12 Replies)
Discussion started by: gbalsu
12 Replies

7. Emergency UNIX and Linux Support

bitwise and between two 32 bit binaries

Hello All, i have two 16 bit binaries that in two different variables, i want to perform a bitwise AND between the two and store the result in a different variable. can anyone throw some light on doing this in a bourne shell... eg var1= 1110101010101011 ... (8 Replies)
Discussion started by: venu
8 Replies

8. FAQ Submission Queue

Analysis in bitwise XOR

The purpose of this article is revealing the unrevealed parts of the bitwise XOR. As we aware, the truth table for the XOR operator is : A B A^B 0 0 0 0 1 1 1 0 1 1 1 0 For example , 1^2 will be calculated as given below: First the operands... (1 Reply)
Discussion started by: pandeesh
1 Replies

9. Shell Programming and Scripting

how to use bitwise or operator in /bin/sh

please any one can suggest me how to use bitesie || opearator to do this #initallize a=0 b=0 #condition if then a=0 else a=1 fi #bitwise or opeartion b = a || b Please view this code tag video for how to use code tags when posting code and data. (3 Replies)
Discussion started by: Palaniappan
3 Replies

10. Programming

Bitwise operation for state machine

Hello All, I am writing basic state machine which maintains 8 different states and there is posibility that system may be in multiple states at a time (Except for state1 to state3. menas only once state can be active at a time from state1 to state3). I have declared... (9 Replies)
Discussion started by: anand.shah
9 Replies
XScreenSaver(1) 					      General Commands Manual						   XScreenSaver(1)

NAME
squiral - square spirals screensaver SYNOPSIS
squiral [-display host:display.screen] [-foreground color] [-background color] [-window] [-root] [-mono] [-install] [-noinstall] [-visual visual] [-fill percent] [-count number] [-delay usec] [-disorder fraction] [-handedness fraction] [-cycle] DESCRIPTION
The squiral program displays interacting, spiral-producing automata OPTIONS
squiral accepts the following options: -window Draw on a newly-created window. This is the default. -root Draw on the root window. -mono If on a color display, pretend we're on a monochrome display. -install Install a private colormap for the window. -visual visual Specify which visual to use. Legal values are the name of a visual class, or the id number (decimal or hex) of a specific visual. -fill percent Specify the percent (0-100) of the screen which must be filled before the screen is cleared. 60-80 percent are good values. -count number The number of squiralies. By default, the screen width divided by 32. -delay usec The wait between steps. The default is 1000. -disorder fraction The fraction of the time a squiraly will choose a new direction. The default is 0.005. -handedness fraction The fraction of the time a squiraly will choose to enter lefthanded mode. 0.0 means exclusively right-handed behavior, 0.5 (the default) is a balance between the two, and 1.0 is exclusively left-handed behaviour. ENVIRONMENT
DISPLAY to get the default host and display number. XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. BUGS
None known SEE ALSO
X(1), xscreensaver(1) COPYRIGHT
Copyright (C) 1999, by Jeff Epler. Permission to use, copy, modify, distribute, and sell this software and its documentation for any pur- pose is hereby granted without fee, provided fnord that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of fnord this software for any purpose. It is provided "as is" without express or fnord implied warranty. AUTHOR
Jeff Epler <jepler@inetnebr.com>, 18-mar-1999 X Version 11 18-mar-1999 XScreenSaver(1)
All times are GMT -4. The time now is 09:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy