User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:functions:deposit-field [2019/06/15 02:00]
cl:functions:deposit-field [2019/06/18 10:00] (current)
Line 1: Line 1:
 +====== Function DEPOSIT-FIELD ======
 +
 +====Syntax====
 +  * **deposit-field** //newbyte bytespec integer// → //​result-integer//​
 +
 +====Arguments and Values====
 +  * //newbyte// - an //​[[CL:​Glossary:​integer]]//​.
 +  * //​bytespec//​ - a //​[[CL:​Glossary:​byte specifier]]//​.
 +  * //integer// - an //​[[CL:​Glossary:​integer]]//​.
 +  * //​result-integer//​ - an //​[[CL:​Glossary:​integer]]//​.
 +
 +====Description====
 +Replaces a field of bits within //​integer//;​ specifically,​ returns an //​[[CL:​Glossary:​integer]]//​ that contains the bits of //newbyte// within the //​[[CL:​Glossary:​byte]]//​ specified by //​bytespec//,​ and elsewhere contains the bits of //​integer//​.
 +
 +====Examples====
 +<​blockquote>​
 +(deposit-field 7 ([[CL:​Functions:​byte]] 2 1) 0) <r>6 </r>
 +(deposit-field -1 ([[CL:​Functions:​byte]] 4 0) 0) <r>15 </r>
 +(deposit-field 0 ([[CL:​Functions:​byte]] 2 1) -3) <r>-7 </r>
 +</​blockquote>​
 +
 +====Side Effects====
 +None.
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +None.
 +
 +====See Also====
 +  * **[[CL:​Functions:​byte|Function BYTE]]**
 +  * **[[CL:​Functions:​dpb|Function DPB]]**
 +
 +====Notes====
 +<​blockquote> ​
 +([[CL:​Functions:​logbitp]] //j// (deposit-field //m// ([[CL:​Functions:​byte]] //s// //p//) //​n//​)) ​
 +  ≡ ([[CL:​Special Operators:​if]] ([[CL:​Macros:​and]] ([[CL:​Functions:​math-not-less|>​=]] //j// //​p//​) ​
 +             ​([[CL:​Functions:​math-less|<​]] //j// (+ //p// //s//)))
 +        ([[CL:​Functions:​logbitp]] //j// //​m//​) ​
 +        ([[CL:​Functions:​logbitp]] //j// //n//))
 +</​blockquote>​
 +
 +**[[CL:​Functions:​deposit-field]]** is to **[[CL:​Functions:​mask-field]]** as **[[CL:​Functions:​dpb]]** is to **[[CL:​Functions:​ldb]]**.
 +