
57 Cal.Rptr.3d 237 (2007)
149 Cal.App.4th 674
The PEOPLE, Plaintiff and Respondent,
v.
Grant MACKLEM, Defendant and Appellant.
No. D046806.
Court of Appeal of California, Fourth District, Division One.
April 10, 2007.
As Modified on Denial of Rehearing May 2, 2007.
*240 David L. Polsky, under appointment by the Court of Appeal, for Defendant and Appellant.
Bill Lockyer, Attorney General, Mary Jo Graves, Chief Assistant Attorney General, Gary W. Schons, Senior Assistant Attorney General, Gil Gonzalez and Raymond M. DiGuiseppe, Deputy Attorneys General, for Plaintiff and Respondent.
HUFFMAN, Acting P.J.
A jury convicted 18-year-old defendant Grant Macklem of first degree murder in the death of his 17-year-old ex-girlfriend Sarah Beagles, and also of a charge of assault with a deadly weapon (plastic pipe) arising out of a jailhouse attack on Ray Doane, with whom Macklem was incarcerated pending trial on the Beagles matter. (Count 1, Pen-Code,[1] § 187, subd. (a); count 5, § 245, subd. (a)(1).) Other charges arising on the day of the murder (forcible sex offenses) were dismissed during trial for insufficient evidence, on a defense motion (§ 1118.1.) The jury could not reach a verdict on an attempted murder charge regarding cellmate Doane, resulting in a mistrial on that charge. (§ 664/187, subd. (a).)
The trial court sentenced appellant to state prison for 25 years to life on count 1 and a consecutive four-year term on count 5, and struck the weapon enhancement. The court awarded Macklem 616 days of custody credit.
On appeal, Macklem contends the trial court prejudicially erred in denying his motion to suppress incriminating statements he made during an interview with a detentions unit detective who told him she was investigating the Doane assault incident that took place at the detention facility. Macklem contends the statements he made during this interview about both offenses were the product of a custodial interrogation and were therefore obtained in violation of his rights under Miranda v. Arizona (1966) 384 U.S. 436, 86 S.Ct. 1602, 16 L.Ed.2d 694 (Miranda) and his right against self-incrimination. This argument requires us to examine the definition of custody for Miranda purposes, in a jailhouse setting. (Cervantes v. Walker (1978) 589 F.2d 424, 427 (Cervantes).)
Macklem also argues the trial court abused its discretion in granting the prosecution's motion to join the two sets of charges for trial, involving the killing of Sarah and the assault on Doane, because the court should not have found the evidence was cross-admissible between the two cases. He additionally argues there was prejudice because each was a relatively weak case which could have been improperly bolstered by the joinder of charges, and the murder/rape charges had an inflammatory effect upon the assault case. Finally, Macklem argues the trial court erroneously failed to award him an additional day of custody credit, for actual time he served in custody from the day of his arrest (late at night), by erroneously calculating credits from the next day when he was booked into jail (after midnight).
After careful consideration of all the briefing, the record and law, we find no violation of Miranda principles. These charges were appropriately joined for trial and the sentence was correct. We affirm the judgment.

FACTUAL AND PROCEDURAL HISTORY
We generally outline the pertinent facts giving rise to the charges and convictions. We will add additional facts as necessary *241 in the discussion portion of this opinion, concerning the Miranda issues and the joinder of charges issues raised on appeal.

A. Death of Sarah Beagles
In September 2003, Macklem was attending a special school because of his attention deficit or attention deficit hyper-activity disorder. He had known Sarah for about five years, since she was 12, and they were boyfriend and girlfriend in 2002, when they engaged in sexual relations. They broke up and Sarah had several other boyfriends, but she and Macklem continued to see each other as friends. Sarah's parents considered Macklem to be one of the family. Sarah was often sad about her grandparents' deaths two years before and also about her boyfriend troubles, and she and Macklem sometimes talked to each other about each of them committing suicide.
On September 19, 2003, Macklem had trouble at school and he and his friend Ben Nelson left school early and hung around. Macklem told Nelson that he was thinking about killing his ex-girlfriend because she had nothing to live for. Nelson responded that he shouldn't be talking like that and could get into trouble, and Macklem agreed. Macklem responded to a phone call from Sarah and joined her at another shopping center, where they had fun shopping and at her house, until they returned to Macklem's home after 9:00 p.m. Macklem's grandmother, Mrs. Edwards, who also lived at the residence, let them in and thought they seemed happy. Macklem's parents were away on a trip.
Macklem and Sarah went out in the backyard to smoke. After a while they went upstairs. About 10:15 p.m., Mrs. Edwards noticed that Sarah's car was still in the driveway so she went upstairs and called through the door that Sarah should go home, and repeated that after receiving a call from Sarah's mother. Mrs. Edwards then got a call from Macklem's mother who told her that he had just called her and told her he did something to Sarah. Mrs. Edwards called 911 as instructed and the police arrived about 10:30 p.m. She told them that Macklem had Asperger's syndrome (a less severe form of autism).
Macklem answered the door and when one of the officers asked him how he was feeling, he answered, "She pushed me for the last time." The officers handcuffed him and while two officers went upstairs, Macklem told the remaining officer, "First big offense. Never killed anyone." Sarah was found apparently dead upstairs, clothed under a blanket, and paramedics were called. Officer Kelley moved Macklem to his patrol car, where he stayed for two and a half hours, past midnight, when he was taken to jail. Macklem made several statements to Kelley during that time, including, "I knew I was going to do this," and "that fucking bitch wasn't even 18 yet." He also said that Sarah used to be his girlfriend and, "at least now she can be with her grandfather in heaven." When Officer Kelley noticed Macklem was uncomfortable in the backseat and said he was sorry, Macklem answered, "No need to be. I know what I've done. I'm going to get what I deserve."
At the police station the next morning, Macklem was interviewed by detectives, who gave him Miranda warnings and made an audiotape of the interview, which was played at trial. The interviewing officer was told by other police officers that Macklem was known to have Asperger's syndrome, causing him to have tunnel vision. Macklem first described his relationship with Sarah, stating that she was his best friend, but they had broken up after they had sexual relations the first time, which upset him as "a very mental crushing *242 blow to have her do that." He said something went "boom" when she got a new boyfriend. She had recently told him she had nothing to live for, after breaking up with another boyfriend and since her grandparents had died, and she and Macklem had asked each other to kill each other. He had premonitions of Wiling her based on his "split personality."
Macklem then described the events of that night, explaining that he became upset after they had sex in the backyard, which he thought was by agreement. While smoking, she then started talking about her ex-boyfriend Andre and said she wanted to save a cigarette for him. Macklem said that he just snapped and he didn't know why.
In the interview, Macklem described his actions in the killing by saying that he took her upstairs to show her something in his room, but then for a second he blanked out and next thing he knew, he was choking her and falling to the floor. She resisted by kicking and struggling, but he had reached the point of no return. He told detectives that after it happened, he meant to say that it was her parents who had pushed her for the last time. He thinks he was trying to break her neck and trying to end her suffering that she had been feeling for the past year due to her family and boyfriend troubles, as she was his best friend. At one point he stopped choking her and listened to see if she still had a heartbeat, and when she did, he finished her off. He said that he had not used all of the rage he felt against her by killing her, and he could have torn her head off her shoulders.
Macklem later told detectives that when Sarah was dead, he realized he had made a terrible mistake and locked himself in his room, smoking. He did not remember what his grandmother said when she knocked on the door, and he surrendered to police when they arrived.
At an autopsy the next day, Sarah was found to have died as a result of strangulation from chest and neck compression. The medical evidence showed she had recently had vaginal intercourse with Macklem, and she also had some bruising inside of her anus.

B. Assault on Cellmate Doane; Jail Interview
On December 29, 2003, Macklem was awaiting trial in the George Bailey detention facility in a special unit for the young and the old. He had several cellmates, including Ray Doane, who was older than he was and was diabetic. Macklem became upset when Doane asked for an extra food tray. Macklem wanted to tell the deputies he thought this was unfair. According to another cellmate, Benito De-Leon, Doane loudly and aggressively told him snitches were assaulted in prison and he demonstrated by swinging around a sock loaded with a bar of soap, in a threatening manner. Macklem became upset and told Doane that nobody threatens him.
After the argument ended, Doane finished his food and went to sleep. Macklem packed a few things and then went into the shower area and apparently removed a PVC pipe from a shower chair. While Doane was still sleeping, Macklem attacked him by slugging and hitting him. When Doane woke up and tried to push Macklem away, Macklem dropped the pipe and pulled Doane onto the floor, and continued to hit and punch him.
Deputy Vasquez arrived in response to screaming and ordered Macklem to stop, and sprayed him with pepper spray when he did not do so. Doane said he was having trouble moving his legs and was taken to the medical facility. According to Deputy Vasquez, Doane was fairly feeble *243 and elderly, while Macklem was significantly larger and younger than Doane.
Detective Danielle Birmingham of the Sheriffs detentions unit was assigned to investigate the incident. She talked to Doane who was bruised and had a bump on his head and seemed visibly shaken by the incident. Doane said that he was trying to educate Macklem about the hazards of being a snitch in prison, such as by showing him how a friend had been beaten to death with soap in socks for being a snitch, but he denied threatening him.
Four days after the incident, Detective Birmingham interviewed Macklem at the Vista detention facility, where he had recently been moved. She asked to speak to Macklem, who was then brought from his cell to a professional interview room, where he smiled and seemed happy to meet with Detective Birmingham. She did not give him any Miranda warnings, but told him he did not have to speak to her. He told her that he thought it was unfair when Doane asked for an extra food tray and he was going to tell deputies. Doane told him snitches were assaulted in prison and he then swung around a sock loaded with soap, in a threatening manner. Macklem was upset and felt threatened. After Doane went to sleep, Macklem pulled a pipe off a shower chair and attacked Doane with it. Macklem explained that he is a smart guy but "just not wired right." Once he becomes angry, it is hard for him to control himself. He told Detective Birmingham that if deputies had not stopped him, he would have killed Doane, and "that's the reason why I'm in here, because no one was there to stop me."

C. Information; Joinder Motion
Pretrial, the People brought a motion to consolidate the charges arising out of Sarah's death and Doane's injuries. (§ 954.) At that time, the charges regarding Sarah also included the offenses of forcible rape (§ 261, subd. (a)(2)), and forcible rape by a foreign object (§ 289, subd. (a)(1)). The charges also included special circumstances death penalty/life without parole allegations, regarding commission of the murder during rape and rape by instrument (§ 190.2, subd. (a)(17)). However, in the motion for joinder, the deputy district attorney indicated that the death penalty was no longer being sought.
Regarding the Doane case, counts 4 and 5 originally charged Macklem with attempted murder (§ 664/187, subd. (a)), and assault with a deadly weapon (a pipe) or by means of force likely to cause great bodily injury (§ 245, subd. (a)(1)). The information alleged the attempted murder was willful, deliberate, and premeditated (§ 189), and that Macklem used a deadly and dangerous weapon during its commission (§ 12022, subd. (b)(1)) and that of the assault (§§ 1192.7, subd. (c)(23), 12022, subd. (b)(1)).
Macklem opposed joinder of the charges, on the basis the evidence was not cross-admissible, because there was no common scheme connecting the crimes and the victims were unrelated in sex and age. Even if cross-admissibility were proper, prejudice would arguably ensue. (Evid. Code, § 1101, subd. (b).) He also contended the "spillover" effect of aggregating the evidence as to an inflammatory murder/rape case and the weaker assault case would create potential prejudice toward him. He intended to present a psychological defense, based on his various diagnoses, that he was unable to form the necessary intent to murder Sarah, and he intended to present a self-defense theory regarding a threat from Doane.
The motion for joinder was heard at the outset of trial and the court granted it, ruling this was an appropriate set of charges to be tried together. The court *244 found that Macklem's statements to Detective Birmingham would be cross-admissible. On November 12, 2004, the consolidated information was filed.

D. Prosecution Case
At trial, the court ruled upon motions in limine and granted the People's motion to admit the statements Macklem made to Detective Birmingham at the jail, subject to further hearing under Evidence Code section 402. Testimony was taken from numerous percipient and expert witnesses, including the detaining officer Kelley and Detective Birmingham. Macklem's motion to suppress the statements made to Detective Birmingham was presented and denied. (§ 1538.5.) The jury viewed the videotape of Macklem's statements to detectives the day after Sarah's death, describing the circumstances surrounding it.

E. Defense Case
Macklem presented supportive testimony from his mother and Sarah's father. He brought a motion to dismiss the rape charges in counts 2 and 3, along with the rape allegations attached to count 1, for lack of sufficient evidence. Originally, the motion was denied without prejudice but it was eventually granted before the case was sent to the jury (pt. G, post).
Additionally, Macklem's motions sought to have the assault and attempted murder counts dismissed as to Doane. That portion of the motion was denied. (§§ 1118.1, 1385.)
Macklem presented extensive testimony and documentary material about his mental condition and various diagnoses he had received since childhood. For example, both psychological and school reports showed Macklem's history of problems from an early age with attention, learning, social interaction, impulse control, temper tantrums, and fighting. His school records from 2001-2003 showed many incidents of aggressive and uncontrolled behavior towards students and teachers. For example, on several occasions, Macklem choked and punched a particular student, Robert, such that he could not breathe. Macklem had also punched teachers and had damaged school property after becoming angry at a sports event. One evaluating doctor testified these incidents were the result of a basic impulse control problem, but that some of them apparently were "very focused and directed."
Macklem's intelligence and mental ability testing results have been inconclusive, as he has been found to be below average in the areas of memory, thought processing, and academic skills. In other tests, he was found to have an average IQ, and he did well on logic and short term memory diagnostic tests. Some evaluators feel Macklem is mainly willfully defiant and manipulative, and because of his moodiness and impulsiveness, he has social impairments and difficulties with interpersonal relationships.
Drs. Glenn Lipson, Alan Lincoln and Marc Lewkowicz testified and interpreted records about Macklem's troubled psychological and mental health. The defense experts and reports made in the past were consistent in finding that Macklem had attention deficit or attention deficit hyper-activity disorder. Many other diagnoses had been made at various times of other conditions from which he may have suffered. Most prominently, the testimony focused on three conditions: Asperger's syndrome, Pervasive Developmental DisorderNot Otherwise Specified (PDDNOS), and/or schizotypal personality disorder.
Asperger's syndrome is a less severe form of autism, which is demonstrated by *245 impaired social interaction, attention problems, rigid behaviors, and fantasy thoughts. Persons with Asperger's generally have few friends and struggle with romantic relationships. They may go into rages and act out, but they cannot explain or understand their behavior. They are capable of manipulating situations to get what they want. In general, they do not care about the impact of their behavior and how it affects others.
Specifically with reference to the assault incident, Dr. Lincoln testified that if a person with Asperger's were in a situation with a fellow inmate who called him a snitch and demonstrated possible jail attacks involving beatings with socks loaded with soap bars, that person might perceive the interaction as an immediate threat and be afraid.
With reference to the killing, Dr. Lincoln also testified that if someone repeatedly asked a person with Asperger's to kill him or her, the person would be likely to fantasize and have difficulty understanding or dealing with those requests.
Another diagnosis made of Macklem was PDD-NOS, whose sufferers generally share similar characteristics to those with Asperger's or autism. These people have occupational, interpersonal, and learning problems.
Likewise, schizotypal personality disorder, which Macklem may have, manifests itself in poor interpersonal skills, fantasies, thought impairments, and emotional problems. At various times, Macklem told people he heard voices he could not understand, which told him to do bad things. However, Macklem never said that any voices had told him to kill Sarah on the night of the incident.
While being interviewed by Dr. Lewkowicz, the defense psychological evaluator, Macklem could not explain why he killed
Sarah and said he felt sad about it. He knew choking someone could cause death and understood that he had killed Sarah. He appeared to the evaluator to be developmentally retarded, having the equivalent communication skills and ability to interact of a five- to eight-year-old child. It was unlikely such a person could understand a sexual relationship such as Sarah had with her boyfriends.
Some earlier evaluations found no convincing evidence that Macklem suffered from Asperger's, autism, PDD-NOS, or neurological or brain abnormalities. Evaluations were inconclusive regarding the presence of Tourette's syndrome.

F. Prosecution's Rebuttal
To rebut the defense psychological evidence, the People presented evidence from Dr. Charles Kerber, a brain specialist, who examined records of Macklem's brain structure and activity. Dr. Kerber did not find any neurological, structural, or functional abnormalities that would explain or affect his behavior.
Also, Dr. Philip Hanger, a psychologist for the Department of Mental Health, reported that during his evaluation of Macklem done shortly before trial, Macklem appeared to be alert and oriented. He was able to respond to questions and carry on a conversation. Dr. Hanger believed Macklem could have been exaggerating or imitating symptoms, and was motivated to do so.

G. Rulings and Verdict
On December 8, 2004, at the close of testimony, the trial court granted Macklem's renewed motion to dismiss the rape charges, along with the rape allegations regarding count 1, and such evidence was excluded accordingly. (§ 1181.1.) The jurors were instructed to consider only the murder and assault charges, without speculating *246 as to why any other charges they had heard about earlier had been dismissed. After deliberations, the jury convicted Macklem on the remaining charges set forth in count 1 (first degree murder) and count 5 (assault with a deadly weapon) and found true the allegations in count 5. However, it deadlocked on the attempted murder charge in count 4, and the trial court dismissed it at the motion of the People.
On May 27, 2005, the trial court sentenced Macklem to state prison for 25 years to life on count 1 and a consecutive four-year term on count 5, and awarded custody credits. The remaining enhancements were stricken. Macklem appeals.

DISCUSSION
We first discuss the contentions regarding the lack of Miranda warnings given to Macklem before the jailhouse interview about the assault on Doane. We then turn to the joinder of charges and whether they represented an abuse of discretion by the trial court. Finally, we will address Macklem's contention regarding the request for an additional day of custody credit.

I

MOTION TO SUPPRESS
Macklem contends the trial court prejudicially erred in denying his motion to suppress incriminating statements he made during his interview with Detective Birmingham, conducted as part of the investigation of the Doane altercation, while he was in detention on the charges of killing Sarah. In that interview, he made statements about both series of events, and he now contends those unwarned statements were the product of a custodial interrogation and were therefore obtained in violation of his rights under Miranda, supra, 384 U.S. 436, 86 S.Ct. 1602, 16 L.Ed;2d 694 and his right against self-incrimination.
We are required to analyze this Miranda claim in light of the factual background for the motion, which is that Detective Birmingham interviewed him at the detention facility where he had been moved after the Doane incident, which occurred while he was already in pretrial detention. This raises issues about whether the defendant was in "custody for Miranda purposes" when interviewed by a law enforcement official at a custodial facility where he was already confined. (People v. Anthony (1986) 185 Cal.App.3d 1114, 1121, 230 Cal.Rptr. 268 (Anthony).)
There is a significant body of law on this question, beginning with Mathis v. United States (1968) 391 U.S. 1, 88 S.Ct. 1503, 20 L.Ed.2d 381 (Mathis), in which a state prisoner, Mathis, was questioned by a federal government agent about certain of his tax returns. The high court rejected the federal government's position that in order for Miranda requirements to apply, the prisoner had to be in custody for the same matter to which the questioning related. Rather, the Court held that he was entitled to receive Miranda warnings before such questioning. This rule was analyzed in Cervantes, supra, 589 F.2d 424, 427, in which a prisoner claimed that any interrogation during his prison confinement constituted custodial interrogation requiring Miranda warnings. However, the Ninth Circuit rejected that position, and stated:
"The concept of `restriction' is significant in the prison setting, for it implies the need for a showing that the officers have in some way acted upon the defendant so as to have `deprived (him) of his freedom of action in any significant way,' [Miranda v. Arizona, supra, 384 U.S. at p. 444, 86 S.Ct. 1602 [citation].] In the prison situation, this necessarily implies a change in the surroundings of the prisoner which results in an added imposition *247 on his freedom of movement. Thus, restriction is a relative concept, one not determined exclusively by lack of freedom to leave. Rather, we look to some act which places further limitations on the prisoner." (Id at p. 428, 86 S.Ct. 1602.)
Many other courts which have considered this issue also, with Cervantes, reject any "per se custody" rule as applied to a prisoner who is being interviewed by law enforcement officers in the prison or detention setting. (See, e.g., United States v. Conley (4th Cir.1985) 779 F.2d 970, 971-974 (Conley); Anthony, supra, 185 Cal. App.3d 1114, 1120-1121, 230 Cal.Rptr. 268; People v. Fradiue (2000) 80 Cal.App.4th 15, 21, 95 Cal.Rptr.2d 1 (Fradiue).)[2] These courts have focused upon four criteria identified in Cervantes for determining voluntariness of a statement under these particular circumstances: whether the language summoning the defendant from his prison lodging was coercive, whether the physical surroundings of the questioning were unduly coercive, whether the defendant was confronted with evidence of guilt, and whether there was an opportunity given to this person to leave the site of the questioning. (Cervantes, supra, 589 F.2d 424, 427-428.)
We will examine these authorities and then analyze this record to determine whether Macklem was in custody for Miranda purposes at the time of the investigative interview conducted by Detective Birmingham, about the Doane incident.

A. Additional Factual Background
In connection with Macklem's motion to suppress the statements made to Detective Birmingham, her testimony was taken in the midst of trial. (§ 1538.5.) When she was assigned to investigate the Doane incident, she arrived on January 2, 2004 at the Vista detention facility where Macklem had recently been moved, and asked to speak to him. At her request, the housing deputy called into Macklem's cell to see if he wanted to come out and talk to the detective. Birmingham waited in a professional interview room (normally used for attorney or doctor consultations), and two housing deputies brought Macklem in handcuffs to the room, from his administrative segregation unit. She assumed that meant he was willing to talk to her. The deputies removed the handcuffs from Macklem and left the room, closing the unlocked door behind them but leaving it ajar.
Detective Birmingham showed Macklem her identification and told him who she was, that she intended to talk to him about Doane, that he was not required to talk to her and that if he wanted to leave at any time, she would leave the room and lock the door, and call the housing deputies to take him back in handcuffs to his housing unit. She did not give him any Miranda warnings, but told him he did not have to speak to her. He stated that was fine and he would talk to her. She did not ask him any questions about the pending murder charges, but he made statements about them at the end of the interview, to the effect that he would have killed Doane if the deputies had not come in, and that was the same reason he was in jail, because there was no one there to stop him at the *248 time he killed Sarah. At that point, she ended the interview and notified deputies that they should come pick him up.
On cross-examination, Macklem's counsel clarified that Birmingham did not know exactly how the housing deputy told Macklem that she was there to talk to him, but Birmingham would normally explain to the deputy that she was there to interview the inmate as the result of an earlier incident. Once Macklem arrived and the cuffs were taken off, she asked him if he wanted to speak with her, and told him he did not have to talk to her and she could have the deputies take him, back to the housing unit at any time, by locking him in the interview room and calling them to do so. She also explained that he did not show any hesitation in talking to her, but rather, seemed quite happy to meet with her and smiled at her. Although she was aware that he had previously been detained in a protective unit for young and old, where the altercation had occurred, she was not knowledgeable about his mental conditions or illnesses.
In making its ruling, the trial court stated that it had reviewed the authorities, including Cervantes, supra, 589 F.2d 424, 427, and Conley, supra, 779 F.2d 970, 971-974, and concluded that in light of the facts presented, the People had sufficiently demonstrated for admissibility purposes that Macklem was not coercively required to go to the interview room and when he got there, he could have refused to talk. The court relied on the fact he was not yet in formal custody on the case involving Doane, and the apparent focus of Detective Birmingham's questioning was to find out what happened and gather information. The court specifically referred to the four factors set forth in Cervantes and Conley, ruling that they did not support any finding that this was custodial interrogation. Specifically, as laid out in Cervantes, the language summoning the defendant was not coercive, the physical surroundings were not unduly coercive, since it was a professional visitor's room, and Macklem was not confronted with evidence of guilt. (Cervantes, supra, 589 F.2d 424, 427.) Finally, Macklem was given the opportunity to leave the interview room by requesting to do so. The motion to suppress was denied.

B. General Legal Principles: Custody
Miranda requires that a person questioned by police after being "taken into custody or otherwise deprived of his freedom of action in any significant way" must first "be warned that he has a right to remain silent, that any statement he does make may be used as evidence against him, and that he has a right to the presence of an attorney, either retained or appointed." (Miranda, supra, 384 U.S. at pp. 444-45, 86 S.Ct. 1602.) Custodial interrogation is" "`questioning initiated by law enforcement officers after a person has been taken into custody or otherwise deprived of his freedom of action in any significant way.'" (Yarborough v. Alvarado (2004) 541 U.S. 652, 661, 124 S.Ct. 2140, 158 L.Ed.2d 938 (Yarborough), italics added, quoting Miranda, supra, 384 U.S. at p. 444, 86 S.Ct. 1602.) When there has been no formal arrest, the custody issue turns on "how a reasonable person in the suspect's position would perceive his circumstances." (Yarborough, 541 U.S. at p. 662, 124 S.Ct. 2140; Berkemer v. McCarty (1984) 468 U.S. 420, 442, 104 S.Ct. 3138, 82 L.Ed.2d 317; People v. Stansbury (1995) 9 Cal.4th 824, 830, 38 Cal.Rptr.2d 394, 889 P.2d 588.)
The custody question is an objective one: "`Once the scene is set and the players' lines and actions are reconstructed, the court must apply an objective test to resolve the ultimate inquiry: was there *249 a formal arrest or restraint on freedom of movement of the degree associated with a formal arrest.'" (Yarborough, supra, 541 U.S. at p. 663, 124 S.Ct. 2140, quoting Thompson v. Keohane (1995) 516 U.S. 99, 112, 116 S.Ct. 457, 133 L.Ed.2d 383; People v. Ochoa (1998) 19 Cal.4th 353, 401, 79 Cal.Rptr.2d 408, 966 P.2d 442 (Ochoa); People v. Smith (2007) 40 Cal.4th 483, 501-502, 54 Cal.Rptr.3d 245, 150 P.3d 1224.)
Neither the subjective views held by the interrogating officers or the defendant are generally relevant to such a determination. (Stansbury v. California (1994) 511 U.S. 318, 323, 114 S.Ct. 1526, 128 L.Ed.2d 293; California v. Beheler (1983) 463 U.S. 1121, 1125, 103 S.Ct. 3517, 77 L.Ed.2d 1275 (Beheler); Ochoa, supra, 19 Cal.4th at p. 401, 79 Cal.Rptr.2d 408, 966 P.2d 442 [absent custodial interrogation, Miranda simply does not come into play].) "[P]olice officers are not required to administer Miranda warnings to everyone whom they question.... Miranda warnings are required only where there has been such a restriction on a person's freedom as to render him `in custody.'" (Oregon v. Mathiason (1977) 429 U.S. 492, 495, 97 S.Ct. 711, 50 L.Ed.2d 714 (Mathiason).)
In Illinois v. Perkins (1990) 496 U.S. 292, 300, 110 S.Ct. 2394, 110 L.Ed.2d 243 (Perkins), the Supreme Court dealt with another aspect of voluntariness of statements made by a detainee, and analyzed the custody issue. It held that "an undercover law enforcement officer posing as a fellow inmate need not give Miranda warnings to an incarcerated suspect before asking questions that may elicit an incriminating response." (Ibid.) In reaching this conclusion, the court found the facts in Mathis, supra, 391 U.S. 1, 88 S.Ct. 1503, 20 L.Ed.2d 381, to be distinguishable, because the suspect in Mathis, while being questioned in jail, was aware that the agent was a government official who was investigating his potential noncompliance with tax laws. Because the agent did not give Mathis any Miranda warnings before questioning, those incriminating statements were not admissible at the later tax fraud trial. (Id. at p. 299, 110 S.Ct. 2394.) The relevant distinguishing factor was that the defendant in Perkins, in speaking to the undercover agent while making incriminating statements, could not reasonably be said to have believed himself to be under coercion, and the court added this caution: "(The bare fact of custody may not in every instance require a warning even when the suspect is aware that he is speaking to an official, but we do not have occasion to explore that issue here.)" (Perkins, supra, 496 U.S. 292, 299, 110 S.Ct. 2394, 110 L.Ed.2d 243; see Garcia v. Singletary (11th Cir.1994) 13 F.3d 1487, 1491, fn. 4 [referring to that statement as dicta].)
Thus, the court in Perkins acknowledged that technically, there are different kinds of custody, including but not limited to detention custody and Miranda custody. Dealing with the undercover agent issue, the court stated: "We reject the argument that Miranda warnings are required whenever a suspect is in custody in a technical sense and converses with someone who happens to be a government agent. Questioning by captors, who appear to control the suspect's fate, may create mutually reinforcing pressures that the Court has assumed will weaken the suspect's will, but where a suspect does not know that he is conversing with a government agent, these pressures do not exist." (Perkins, supra, 496 U.S. at p. 297, 110 S.Ct. 2394.)
For our purposes here, Perkins indicates that we should consider the interplay between police custody and police interrogation when considering the need to *250 proviue Miranda protections against coercion. (See Dressier & Michaels, Understanding Criminal Procedure (4th ed.2006) vol. 1, § 24.11(B), pp. 513-514.) In the factual context of a prisoner in pretrial detention, who is being questioned about a different offense than the one leading to the pretrial detention, the analysis of the current custodial status must take into account the type of custody, the type of questioning, and the identity of the questioner.

C. Specific Legal Principles: Additional Custody Within Custody
In applying these rules, one must be mindful of the various policies served by the Miranda decision. The Fifth Amendment was intended to ensure the reliability of confessions, while also "limiting police interrogation tactics that are offensive even though they may result in reliable confessions in some cases." (Magid, Questioning the Question-Proof Inmate: Defining Miranda Custody for Incarcerated Suspects (1997) 58 Ohio St. L.J. 883, 916 (hereafter Magid).) In addition, the Supreme Court has sought in developing its Miranda principles to promote other public purposes: i.e., "the provision of guidance to law enforcement actors and the conservation of judicial resources." (Id. at page 917.) This commentator identifies the subject conceptual problem as follows:
"On a superficial review, all incarceration might seem to constitute custody since inmates cannot, of course, leave the facility in which they are incarcerated. But custody in layperson's terms is not necessarily custody for Miranda purposes. Miranda's definition of custody reflects a concern more with the coercive forces that may affect interactions between a suspect and an interrogating official, and less with the fact that a person's ability to select his activities and routine is greatly limited as an inmate. [K] Thus, many courts have convincingly made a distinction between custody for Miranda purposes and general prison population confinement. In these cases, the courts justified interrogation undertaken in the absence of any Miranda warnings by concluding that the inmates were not entitled to warnings because they were not in custody for Miranda purposes." (Id. at p. 933, fn. omitted.)[3]
Thus, it has been repeatedly recognized that it is difficult to apply basic Miranda principles in the context of questioning directed to a prisoner who is already under detention in a custodial facility. "Courts have rightfully concluded that while the Miranda considerations are quite relevant within prison walls, the definition of custody must take into account the highly regulated life of inmates." (Magid, supra, 58 Ohio St. L.J. 883, 916, 941.) When is there an additional degree of "formal arrest or restraint on freedom of movement," in jail? (See Anthony, supra, 185 Cal.App.3d at p. 1121, 230 Cal.Rptr. 268, citing Mathiason, supra, 429 U.S. 492, 97 S.Ct. 711, 50 L.Ed.2d 714.)
To answer this question in this case, we compare the relevant factors identified in the leading cases to our own set of facts. In Cervantes, the court found the most significant criterion in Mathis, supra, 391 U.S. 1, 88 S.Ct. 1503, 20 L.Ed.2d 381, was that he was being questioned about matters that did not arise within the prison itself, by a government agent who was not a member of the prison staff; the prisoner *251 was therefore subjected to an additional imposition on his limited freedom of movement, thus requiring Miranda warnings." (Cervantes, supra, 589 F.2d 424, 428.) The fact situation in Cervantes involved more immediate events, in that the inmate was involved in a recent fight at the facility and was taken to the local library for questioning, where he left his property outside the library as directed and it was searched. When contraband was found, he responded to questioning by saying, "`That's grass, man.'" (Id. at p. 427.) He was then arrested for possession of marijuana, and his efforts to suppress those statements were rejected on Miranda grounds, because he was not found to be in any additional custody over and above his prisoner status, for purposes of that questioning. (Ibid.) In reaching that conclusion, the court considered "`the language used to summon him, the physical surroundings of the interrogation, the extent to which he is confronted with evidence of his guilt, and pressure exerted to detain him,'" to determine if Miranda warnings were required. (Id. at pp. 427-428.) The court said no such warnings were necessary, opining:
"To interpret Mathis as Cervantes urges would, in effect, create a per se rule that any investigatory questioning inside a prison requires Miranda warnings. Such a rule could totally disrupt prison administration. Miranda certainly does not dictate such a consequence.... [¶] Adoption of Cervantes' contention would not only be inconsistent with Miranda but would torture it to the illogical position of providing greater protection to a prisoner than to his nonimprisoned counterpart. We cannot believe the Supreme Court intended such a result." (Cervantes, supra, 589 F.2d at p. 427.)
Likewise, in Fradiue, supra, 80 Cal. App.4th 15, 19-20, 95 Cal.Rptr.2d 1, the court considered whether that defendant, as a reasonable person, would believe there had been a restriction of his freedom over and above that inherent in his normal prison setting, when he answered questions from a correctional officer who was his prison-appointed fact finder, appointed to investigate recent administrative charges of contraband in the prison setting. Defendant did not disqualify the appointed officer as he could have done under the prison regulations. The officer then came to defendant's cell and asked him questions about the contraband through a slot in his administrative segregation cell door. The court denied defendant's motion to suppress the statements in response to those questions, reasoning under Cervantes, supra, 589 F.2d 424, that the defendant had not been summoned for questioning, he was not restrained inside his cell, the officer informed him he was able to reject him as the appointed investigator, and the interview was known to be for the purpose of assisting the inmate to prepare a defense. Defendant knew he was free to stop talking to the investigator at any time, and he was not confronted with evidence of guilt. Under the totality of the circumstances, the court found no Miranda, warnings were required, because "no restraints were placed upon defendant to coerce him into participating in the interrogation over and above those normally associated with his inmate status." (Fradiue, supra, 80 Cal.App.4th 15, 21, 95 Cal. Rptr.2d 1.)
In Conley, supra, 779 F.2d 970, 971-974, no Miranda violation was found when a wounded prisoner was questioned in a conference room while he was awaiting transfer to the jail infirmary and again when he returned. These interviews both took place shortly after another prisoner was stabbed to death. The court observed, "Prisoner interrogation simply does not lend itself easily to analysis under the *252 traditional formulations of the Miranda rule. A rational inmate will always accurately perceive that his ultimate freedom of movement is absolutely restrained and that he is never at liberty to leave an interview conducted by prison or other government officials. Evaluation of prisoner interrogations in traditional freedom-to-depart terms would be tantamount to a per se finding of `custody,' a result we refuse to read into the Mathis decision. [11] A different approach to the custody determination is warranted in the paradigmatic custodial prison setting where, by definition, the entire population is under restraint of free movement." (Conley, supra, 779 F.2d at p. 973, cited in Anthony, supra, 185 Cal.App.3d 1114, 1121-1122, 230 Cal.Rptr. 268 [no Miranda violation found where Anthony, a defendant in jail, initiated phone calls to police that contained incriminating material].)
Thus, in Conley, supra, 779 F.2d 970, the court found Conley was not "in custody" for Miranda purposes when questioned, because his freedom of movement was not restricted past the ordinary degree. When he was taken to the place where the questioning occurred, it was done in a routine manner, such that he was placed in restraints for purposes of obtaining medical treatment, and he was not questioned as a suspect but rather as a witness to the stabbing, and only briefly by guards who knew him. In contrast, the court noted that a companion motion to suppress had properly been granted in Conley's case, with respect to statements made to an FBI agent who questioned Conley, since that agent came into the prison as an outside investigator, who was thus in a different category of interviewers under the applicable case law, such as Mathis, supra, 391 U.S. 1, 88 S.Ct. 1503, 20 L.Ed.2d 381. (Conley, supra, at p. 974, fn. 5.)
This point is further illustrated in an opinion from this Court, People v. Ravaux (2006) 142 Cal.App.4th 914, 920-921, 49 Cal.Rptr.3d 211 (Ravaux), in which we compared the definition of "custody" for Miranda purposes to "custody" for sentencing purposes (assigning credits under section 2900.5; see part III, post, and fn. 3, ante). With respect to the Miranda custody definition, we said: "In that context an individual is in custody for the purposes of determining whether he has a right to counsel and must be informed of his right to remain silent, if a reasonable person in the same situation would believe they are not free to leave. [Citation.]" (Id. at p. 920, 49 Cal.Rptr.3d 211.) We then stated that such a definition of custody was inapposite for purposes of interpreting credit entitlements under section 2900.5, based on evaluating time spent in residential custody, because "[s]ection 2900.5 defines custody so that those who are incarcerated receive credit for the time they serve. Applying the Miranda standard in this context does not further the policy advanced in either." (Ravaux, supra, at p. 921, 49 Cal.Rptr.3d 211.)
In summary, the contrary reasoning in an older case, United States v. Cadmus (D.C.N.Y.1985) 614 F.Supp. 367, 373, has not been found persuasive by later analyses in its adoption of a per se custody rule, which it stated as follows: "[A] fair reading of Miranda and Mathis leads ineluctably to the conclusion that custody is custody-an individual incarcerated, or detained in a prison-like facility, is in custody and must be advised of his Miranda rights before any interrogation can take place." That "per se" reasoning does not account for the well-recognized distinctions in the technical categories of custody that may exist at a given time, such as temporary Miranda custody, more long-term, institutional custody, or custody determinations for purposes of awarding *253 custody credits at sentencing,[4] (See Perkins, supra, 496 U.S. 292, 296-299, 110 S.Ct. 2394, 110 L.Ed.2d 243.)

D. Analysis
To evaluate any error in admitting a defendant's prearrest statements, the standard used is harmlessness beyond a reasonable doubt. (See People v. Johnson (1993) 6 Cal.4th 1, 32-33, 23 Cal.Rptr.2d 593, 859 P.2d 673 [applying "harmless beyond a reasonable doubt" standard of Chapman v. California (1967) 386 U.S. 18, 24, 87 S.Ct. 824, 17 L.Ed.2d 705 to Miranda error].) Under that prejudice standard, an error may be found harmless only when the "beneficiary of a constitutional error ... prove[s] beyond a reasonable doubt that the error complained of did not contribute to the verdict obtained." (Chapman, supra, at p. 24, 87 S.Ct. 824.)
Utilizing an objective standard, we seek to determine whether Macklem, when answering Birmingham's questions, was in "custody for Miranda purposes." This is a mixed question of law and fact, in which we ask: "[F]irst, what were the circumstances surrounding the interrogation; and second, given those circumstances, would a reasonable person have felt he or she was not at liberty to terminate the interrogation and leave." (Ochoa, supra, 19 Cal.4th at pp. 401-402, 79 Cal. Rptr.2d 408, 966 P.2d 442.) This is determined on the totality of the circumstances surrounding the alleged interrogation, to decide if prison officials applied additional restraints that further restricted Macklem's freedom, thereby triggering Miranda warning obligations. (Fradiue, supra, 80 Cal.App.4th at p. 21, 95 Cal. Rptr.2d 1.)
Since Macklem was not free to leave the detention facility entirely, we analyze the facts to determine whether some additional degree of restraint was imposed upon him that forced him to participate in this interview, in light of the criteria summarized above. First, with respect to the language used to summon him for questioning, Detective Birmingham requested that the housing deputy contact Macklem at his cell and ask him if he was willing to come out and talk, but she communicated both to the deputy and to Macklem that he was not required to do so. Unlike in Mathis, supra, 391 U.S. 1, 88 S.Ct. 1503, 20 L.Ed.2d 381, and in the companion motion to suppress referred to in Conley, supra, 779 F.2d 970, she was not an investigator from an outside entity or from a different jurisdiction, or who was investigating charges that had arisen independently of the jail setting. Rather, she caused Macklem to be told she was a sheriffs detective investigating the recent jailhouse incident, which removed any element of surprise that appeared to be operating in Mathis. (See Conley, supra, 779 F.2d at p. 974, fn. 5 [noting there are different categories of interviewers for these purposes].) Here, the questioning related to matters arising from the original conditions of confinement.
Since Macklem arrived at the interview room in handcuffs and was uncuffed and left there with the door ajar, with Birmingham, these facts as a whole support a reasonable inference that he showed willingness to participate in her interview. Those physical surroundings of the interrogation *254 weigh against any finding of coerciveness, since he was left there and told he would be taken back at his request, and asked if he wanted to answer questions there. Moreover, an interview room where attorneys and doctors visit to consult inmates is as close to neutral territory as is available in the detention facility.
Under the third factor, there is no clear indication that Macklem was confronted with evidence of his guilt, since Detective Birmingham conducted the interview by asking him what he knew about the Doane incident. She terminated the interview when he started talking about Sarah's case.
Finally, these circumstances do not disclose that any additional pressure was exerted to detain him in a coercive manner. Macklem was given the opportunity to leave the room if he requested to do so. Even in light of the knowledge that Detective Birmingham had, that Macklem was previously detained in a protective unit for young and old, the reasonable prisoner standard still applies and Macklem was being treated like any other adult inmate who had some mental problems. No apparent additional degree of restraint was imposed on him to coerce him into participating in the interview beyond the everyday conditions of confinement.
We therefore conclude the trial court correctly applied the authorities to determine that a reasonable person in Macklem's position would have realized that he could end the questioning and leave before the end of the interview. It is not dispositive that the conversation here took place at the detention facility, since Macklem was told he could leave the interview room itself at any time and did not have to discuss the issues. (Yarborough, supra, 541 U.S. at pp. 661-663, 124 S.Ct. 2140.) Under the totality of the circumstances, he was not in custody for purposes of Miranda, the protections of Miranda did not apply, and the failure of the detective to give a Miranda warning did not make his statements inadmissible.
Even if we assume the trial court erred in admitting the statements made to Detective Birmingham, the People have demonstrated that the error was harmless, in that the evidence did not contribute in the verdict. (People v. Johnson, supra, 6 Cal.4th 1, 32-33, 23 Cal.Rptr.2d 593, 859 P.2d 673.) Those statements were not essential to the proof of either the Doane or the Sarah offenses, and we next discuss the cross-admissibility issues raised regarding joinder.

II

JOINDER
At the outset of trial, the court granted the motion for joinder, finding this was an appropriate set of charges to be tried together. Macklem concedes that the murder and assault charges were similar enough to be subject to joinder, since the offenses are of "the same class." (§ 954.) He nevertheless contends this ruling was an abuse of discretion, mainly arguing the court erred in finding the evidence would be cross-admissible regarding the two offenses, because there was no common scheme connecting the crimes and the victims were unrelated in sex and age. He also contends that even if cross-admissibility were proper, undue prejudice would result from the "spillover" effect of aggregating the evidence as to the inflammatory facts of the murder/rape charges and the assault case, both of which he believed were weak cases. (Evid.Code, § 1101, subd.(b).) He also argued the specter of the original death penalty charges would create potential prejudice, since they could have been reinstated at some point.
*255 We first take note that both parties essentially agree the record is sufficient for us to review the factors set forth in case law for ruling upon a joinder request, even though the trial court did not spell out its reasoning when it granted the motion for joinder.

A. Standards of Review
Under section 954, "[a]n accusatory pleading may charge two or more different offenses connected together in their commission ... or two or more different offenses of the same class of crimes or offenses, under separate counts, ... provided, that the court in which a case is triable, in the interests of justice and for good cause shown, may in its discretion order that the different offenses or counts set forth in the accusatory pleading be tried separately or divided into two or more groups and each of said groups tried separately...." "Offenses committed at different times and places against different victims are, nevertheless, `connected together in their commission' when there is a 'common element of substantial importance' among them. [Citations.]" (People v. Matson (1974) 13 Cal.3d 35, 39, 117 Cal.Rptr. 664, 528 P.2d 752.)
The joinder of such related charges, "whether in a single accusatory pleading or by consolidation of several accusatory pleadings, ordinarily avoids needless harassment of the defendant and the waste of public funds which may result if the same general facts were to be tried in two or more separate trials [citation], and in several respects separate trials would result in the same factual issues being presented in both trials." (Ochoa, supra, 19 Cal.4th 353, 409, 79 Cal.Rptr.2d 408, 966 P.2d 442.) "Because consolidation ordinarily promotes efficiency, the law prefers it." (Ibid.)
However, a trial court may order separate trials "in the interests of justice and for good cause shown." (§ 954.) The defendant must "`clearly establish that there is a substantial danger of prejudice requiring that the charges be separately tried.'" (People v. Davis (1995) 10 Cal.4th 463, 508, 41 Cal.Rptr.2d 826, 896 P.2d 119.) "[C]ross-admissibility [of evidence] ordinarily dispels any inference of prejudice...." (People v. Mason (1991) 52 Cal.3d 909, 934, 277 Cal.Rptr. 166, 802 P.2d 950; People v. Carter (2005) 36 Cal.4th 1114, 1154, 32 Cal.Rptr.3d 759, 117 P.3d 476.)
Cross-admissibility of evidence, however, is not required for joint trials; "[b]ecause of the factors favoring joinder, a party seeking severance must make a stronger showing of potential prejudice than would be necessary to exclude other-crimes evidence in a severed trial." (People v. Arias (1996) 13 Cal.4th 92, 127, 51 Cal.Rptr.2d 770, 913 P.2d 980; see also § 954.1.) To discharge the burden of showing prejudice, the defendant must show, in addition to lack of cross-admissibility, some other factor is present, for example, that one of the offenses was substantially more inflammatory than the others or was supported by significantly stronger evidence. (Frank v. Superior Court (1989) 48 Cal.3d 632, 641, 257 Cal.Rptr. 550, 770 P.2d 1119.)
Generally, the decision to try separate charges together is reviewed for abuse of discretion. (People v. Osband (1996) 13 Cal.4th 622, 666, 55 Cal.Rptr.2d 26, 919 P.2d 640.) "A court abuses its discretion when its ruling `falls outside the bounds of reason.'" (Ibid.) Determinations of whether the trial court abused its discretion in joining counts for trial will be based on the facts as they appeared at the time of the hearing. (People v. Douglas (1991) 234 Cal.App.3d 273, 281, 285 Cal. *256 Rptr. 609.) However, "[e]ven if a trial court's severance or joinder ruling is correct at the time it was made, a reviewing court must reverse the judgment if the 'defendant shows that joinder actually resulted in "gross unfairness" amounting to a denial of due process.'" (People v. Mendoza (2000) 24 Cal.4th 130, 162, 99 Cal. Rptr.2d 485, 6 P.3d 150 (Mendoza).)

B. Application
In its motion for joinder, the prosecution mainly relied upon three factors to argue that evidence regarding the murder count and the assault count would be cross-admissible, and no prejudice would occur from joinder. Macklem made statements to Detective Birmingham referring to both cases, and the prosecution intended to use them in both cases. Also, the prosecution intended to prove the facts underlying both cases to show Macklem had the ability to form the necessary mental states to commit the charged offenses. This could be pursued through cross-examination of the defense mental health experts. Finally, the prosecution argued both offenses involved violent attacks and vulnerable victims.
We first address Macklem's arguments regarding cross-admissibility of evidence of these offenses. We then turn to his contentions regarding prejudice.
Evidence Code section 1101, subdivision (b) allows uncharged offenses to be used to establish something other than the defendant's disposition to commit a particular act, and this may include facts such as motive, intent, preparation or plan. (See People v. Carter, supra, 36 Cal.4th 1114, 1154, 32 Cal.Rptr.3d 759, 117 P.3d 476.) The least degree of similarity is required to establish that uncharged offenses may be used to support an inference of similar intent in each case. (People v. Kipp (1998) 18 Cal.4th 349, 369-371, 75 Cal.Rptr.2d 716, 956 P.2d 1169.)
With regard to the intent demonstrated in the two instances, Macklem intended to show he acted in self-defense against Doane, and lacked the ability to act with an intent to murder Sarah, due to his mental disabilities. However, the prosecution could properly seek to counter those defenses by showing that Macklem had a history of attacking other people and he understood that he could hurt them. To support the prosecution's theory that he could form an intent to kill or harm, the prosecution could properly bring in evidence of motivation and planning in the two sets of charges.
For each offense, there was some evidence of planning and preparation. Macklem told his friend Nelson that he was planning to kill his ex-girlfriend and he later told detectives that he had been having premonitions and thinking about doing so for a week or two. At the time he assaulted Doane, they had been cellmates for a while and were acquainted, and after their dispute about the meal, Macklem packed up, went into the shower room and took apart a shower chair, showing some kind of planning. Although Sarah was a young girl and Doane was an older man, they were both people with whom Macklem was familiar and they were both physically vulnerable compared to him, and neither was expecting the attack.
When Macklem saw the police officers after killing Sarah, he said that she pushed him for the last time, and called her a "fucking bitch," which seems to indicate he acted in response to some kind of threat, which was also presumably the case regarding Doane, at least in Macklem's mind. Although he told detectives he meant that her parents had pushed her for the last time, that is not the only way to interpret the evidence. Both offenses took *257 place in response to an upsetting event, which is a "`common element of substantial importance' between them." (People v. Matson, supra, 13 Cal.3d 35, 39, 117 Cal.Rptr. 664, 528 P.2d 752.) It is not dispositive that Macklem's defense was that he was seeking to relieve Sarah's suffering, because the evidence could also be interpreted that his actions were motivated by or in response to anger. Macklem cannot convincingly argue that the two assaultive incidents are not similar enough so that their features could not be cross-admissible, and those features show more than a propensity to commit a certain type of act.
Further, Macklem told the police at the scene that he knew what he had done and he was going to get what he deserved. His statements to Detective Birmingham explained that the reason he had not killed Doane was that someone was there to stop him, unlike in Sarah's case. These statements tend to support the prosecution's theory that the two offenses were committed for similar reasons or motivations, and that their intents were similar. The jury was instructed in the language of CALJIC No. 2.51 regarding the proper use of evidence to show motive.
Even if cross-admissibility had not been demonstrated, Macklem would still have to show prejudice from one of the remaining factors. Regarding the inflammatory nature of the murder and rape charges, we disagree with his argument that Sarah's age (17, a minor) was a particularly prejudicial factor against him, since he was of similar age and they had been friends throughout their teenage years. This is not a case of a predatory adult charged with a child molestation, for example, which would qualify as an inflammatory offense for joinder or severance purposes. (See People v. Poggi (1988) 45 Cal.3d 306, 322, 246 Cal.Rptr. 886, 753 P.2d 1082.)
Similarly, the attack on Doane was not completely lacking in extreme or inflammatory features, such that the two offenses were too disparate to be tried together. Doane was sleeping when Macklem tackled him, and any provocation caused by Doane was not relatively extreme in nature. Neither of these offenses was so inflammatory compared to the other that they could not properly be tried together.
Macklem further contended that in light of his self-defense claim regarding the Doane case, the assault charge was weak and the murder case facts should not be allowed to support it. However, he is unable to show prejudice in this respect, since the trial court could reasonably evaluate both charges as relatively strong, since there was no dispute as to the identity of the perpetrator, but merely disputes about intent and motivation, in light of the psychological evidence. Even though the expert evaluations and diagnoses were inconclusive regarding the presence or absence of Asperger's, PDD-NOS, or neurological or brain abnormalities, the trier of fact could properly be allowed to sort out those factors in evaluating the evidence.
The jury was presented with evidence supporting the prosecution's theories that Macklem had the ability to control his actions and understand their consequences during both incidents. Macklem had been able to maintain relationships with friends and family and showed some age-appropriate social skills. He described his actions during the two incidents in a way that would support conclusions that he was making deliberate decisions to proceed with the attacks. He had shown aggressive behavior in the past when he was offended or angry. It does not make any difference that eventually, the rape charges were dropped and the jury could not reach a verdict on attempted murder *258 as to Doane. We analyze the ruling with respect to the facts as of the time of the motion. Further, the evidence as a whole separately supported the convictions on each count. (Mendoza, supra, 24 Cal.4th at pp. 159-162, 99 Cal.Rptr.2d 485, 6 P.3d 150.)
Finally, Macklem is not justified in relying on the special circumstances allegations originally made with respect to the rape charges, since the People were not seeking the death penalty as of the time the motion was decided at the outset of trial, nor was there any indication that the sentencing factors alleged under section 190.1, subdivision (a) were going to be reinstated for the purpose of seeking the death penalty. The jurors received instructions about the charges to be considered and were not reasonably likely to have been confused by that set of pleadings.
Based on the facts as of the hearing time, the trial court's ruling was reasonable and within the bounds of its discretion. The court had enough evidence before it to compare the manner of the attacks, showing some kind of similarity in motive, and the presence of planning in each case. Each case was individually supported by comparably strong evidence. Moreover, viewed in light of the evidence presented at trial, the judgment is not subject to reversal based on any unfairness in the joinder ruling that would amount to a denial of due process. (Mendoza, supra, 24 Cal.4th 130, 162, 99 Cal.Rptr.2d 485, 6 P.3d 150.)

III

CUSTODY CREDITS
At sentencing on May 27, 2005, the trial court awarded Macklem 616 actual days of presentence custody credit, by utilizing the date of his booking confinement, September 20, 2003. Macklem brought two ex parte motions seeking to have the trial court award him one additional day credit for time served, based on the theory that he was arrested before midnight on September 19, 2003, and he was therefore in "custody" one more day than the booking date of September 20, 2003 would reflect. The trial court denied the first motion without prejudice, based on the probation report data.
In support of the renewed motion, Macklem submitted an excerpt from trial testimony about the arrest, showing that he was placed in the police car at 10:30 p.m. on September 19 and remained there until after 1:00 a.m. on September 20, when evidence had been obtained and he was transported to jail. The trial court denied the renewed motion, first observing that the trial transcript did not specify when the arrest was actually made. For purposes of calculating credits, the court relied on People v. Smith (1989) 211 Cal. App.3d 523, 526, 259 Cal.Rptr. 515, dealing with an analogous situation of admission to and release from custody prior to sentencing. (§ 2900.5.) The trial court reasoned that Macklem was not delivered to the formal custody of the detention facility until he was booked, and he was entitled to sentencing credits beginning when he was actually officially booked into custody.
By supplemental brief, Macklem appeals. He argues the trial court erred in commencing credit for actual time he served in custody on the day he was booked into jail, rather than the earlier day of his arrest. He cites to section 4019, governing the award of presentence custody credit, as referring to a credit for all days of custody from the date of arrest, and therefore argues that he was deemed arrested when he was detained in handcuffs and placed in the police car the evening of September 19. (People v. Freund (1975) 48 Cal.App.3d 49, 54, 119 Cal.Rptr. 762; compare language of § 2900.5, defining custody for purposes of allocating credit *259 to those who are incarcerated for time served.)
The probation report indicates the date that Macklem was confined was September 20, and he remained so until the following May 27, when sentencing took place. On this record, the trial court properly awarded credit for time served because credit for time served commences on the day a defendant is booked into custody. (Ravaux, supra, 142 Cal.App.4th 914, 919-921, 49 Cal.Rptr.3d 211.) Properly interpreted, section 2900.5 authorizes the award of custody credits for time spent in residential detention facilities, not for time spent in police custody prior to that event. Macklem is not entitled to another day's custody credit for time served.

DISPOSITION
Judgment is affirmed.
WE CONCUR: McDONALD, and McINTYRE, JJ.
NOTES
[1]  All further statutory references are to the Penal Code.
[2]  In People v. Roldan (2005) 35 Cal.4th 646, 736, footnote 41, 27 Cal.Rptr.3d 360, 110 P.3d 289, the California Supreme Court characterized the holding of Fradiue, supra, 80 Cal.App.4th 15, 19-21, 95 Cal.Rptr.2d 1, as follows, while declining to address a similar issue not squarely presented: "[S]ome additional restraint, over and above mere incarceration, is required before an interrogation is custodial for Miranda purposes." (Roldan, supra, at p. 736, fn. 41, 27 Cal.Rptr.3d 360, 110 P.3d 289.)
[3]  Another identifiable type of custody is long-term "institutional custody," as distinguished from temporary "Miranda custody." (State v. Overby (Georgia 1982) 249 Ga. 341, 290 S.E.2d 464, 465; Magid, supra, 58 Ohio St. L.J., p. 933, fn. 169.)
[4]  Our analysis of the differences between Miranda custody and general detention or sentencing custody is intended to focus on whether Miranda warning obligations have been independently triggered by the happening of an event that significantly affects the prisoner's current custodial status. (See Perkins, supra, 496 U.S. 292. 296-299, 110 S.Ct. 2394, 110 L.Ed.2d 243.)
