Sponsored Content
Full Discussion: Number to bit vector
Top Forums Programming Number to bit vector Post 302968539 by Don Cragun on Thursday 10th of March 2016 02:15:06 PM
Old 03-10-2016
Quote:
Originally Posted by yifangt
Thanks Don!
Your reply overwhelmed me to death! As usual, this is way more than I needed.
BTW, how long does it take for a regular CS graduate to get the level like this with C?
I'm glad that my code helped, but there isn't anything overwhelming in what I did. Start at the beginning and decide what you want to do. Then build the pieces you need to get there one by one until you have something that works. If you run into a problem with one of the pieces fitting in after you have started working on another piece, don't be afraid to throw one or both of them away and redo it/them a different way that fits in better.

I have no idea what a regular CS graduate now days knows about C, nor how long it takes one to be able to read, understand, nor write a program like this. But, a few decades of fixing bugs in other people's code, writing my own code, and writing and maintaining the standards that specify the behavior of the POSIX-specified utilities and C interfaces certainly helps. The key point is that practicing programming helps. Smilie

When I was a CS grad, I knew FORTRAN and three different assembler languages and a couple of FORTRAN high precision math libraries. I picked up Algol, COBOL, Lisp, and PL/1 in a comparative programming languages course one semester while working on my Masters in computer engineering. (I used to have decks of cards in Algol, COBOL, Fortran, Lisp, and PL/1 that could read in a number expressed as Roman numerals, multiply it by two and add seven, and write out the result as Roman numerals. I won't say that I mastered COBOL, Lisp, and PL/1 in those thirteen weeks; but I learned how to read a manual and how to experiment with code.) After college, I was able to learn a few other programming languages in about a week of concentrated study as long as I had easy access to a compiler for that language, a good manual for that language, and no distractions. Note, however, that I have never claimed to be normal nor regular.
This User Gave Thanks to Don Cragun For This Post:
 

6 More Discussions You Might Find Interesting

1. Programming

copying or concatinating string from 1st bit, leaving 0th bit

Hello, If i have 2 strings str1 and str2, i would like to copy/concatenate str2 to str1, from 1st bit leaving the 0th bit. How do i do it? (2 Replies)
Discussion started by: jazz
2 Replies

2. Shell Programming and Scripting

Help needed in converting number to bit

Hi, I have the following file input:- 542 4795 61 543 4795 61 544 0 0 545 292 ... (5 Replies)
Discussion started by: ahjiefreak
5 Replies

3. Programming

Help with bit vector and setting its bits?

void shuffle (card_t cards, card_t cards2, char *bitvec) { int i; unsigned char temp, r; srand(time(NULL)); for (i = 0; i < 52; i++) { r = rand() % 52; temp = bitvec; if (!(temp & (1 << (8- (r % 8))))) { temp |= (1 << (8- (r % 8)));------->is this my problem? } } } ok so I am... (1 Reply)
Discussion started by: bjhum33
1 Replies

4. Shell Programming and Scripting

How to handle 64 bit arithmetic operation at 32 bit compiled perl interpreter?H

Hi, Here is the issue. From the program snippet I have Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF which are of 40 and 56 bits. SO I used use bignum to do the math but summing them up I always failed having correct result. perl interpreter info, perl, v5.8.8 built for... (0 Replies)
Discussion started by: rrd1986
0 Replies

5. Programming

How bit representation of a number can be done in c?

I have an assignment in which a character is the input of which some bits(from a position to certain position) are to be inverted (1's complement) and then the resultant character is to be returned....for example unsigned char x = J from p = 3 to offset n = 5 01001010 inverted to... (1 Reply)
Discussion started by: ezee
1 Replies

6. Windows & DOS: Issues & Discussions

Which version of Windows Vista to install with a product key? 32-bit or 64-bit?

Hello everyone. I bought a dell laptop (XPS M1330) online which came without a hard drive. There is a Windows Vista Ultimate OEMAct sticker with product key at the bottom case. I checked dell website (here) for this model and it says this model supports both 32 and 64-bit version of Windows... (4 Replies)
Discussion started by: milhan
4 Replies
Traffic control index filter(8)                                        Linux                                       Traffic control index filter(8)

NAME
tcindex - traffic control index filter SYNOPSIS
tc filter ... tcindex [ hash SIZE ] [ mask MASK ] [ shift SHIFT ] [ pass_on | fall_through ] [ classid CLASSID ] [ action ACTION_SPEC ] DESCRIPTION
This filter allows to match packets based on their tcindex field value, i.e. the combination of the DSCP and ECN fields as present in IPv4 and IPv6 headers. OPTIONS
action ACTION_SPEC Apply an action from the generic actions framework on matching packets. classid CLASSID Push matching packets into the class identified by CLASSID. hash SIZE Hash table size in entries to use. Defaults to 64. mask MASK An optional bitmask to binary AND to the packet's tcindex field before use. shift SHIFT The number of bits to right-shift a packet's tcindex value before use. If a mask has been set, masking is done before shifting. pass_on If this flag is set, failure to find a class for the resulting ID will make the filter fail and lead to the next filter being con- sulted. fall_through This is the opposite of pass_on and the default. The filter will classify the packet even if there is no class present for the resulting class ID. SEE ALSO
tc(8) iproute2 21 Oct 2015 Traffic control index filter(8)
All times are GMT -4. The time now is 12:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy